I tried in cmd "composer require nesbot/carbon" but I got this:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
- laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
- laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
- Installation request for laravel/framework (locked at v5.6.27, required as 5.6.*) -> satisfiable by laravel/framework[v5.6.27].
Installation failed, reverting ./composer.json to its original content.
I don't recommend doing this without extreme caution because there may be a reason why Laravel, or any of your other dependencies, require a very strict version of a package.
With that said, Composer does include a neat trick to alias versions to get around this by specifying an alias version in composer.json:
"require": {
...
"nesbot/carbon": "1.32.0 as 1.25.0"
},
Note the as 1.25.0 which will trick other packages into thinking 1.32.0 is equivalent to 1.25.0 for dependencies. This trick requires exact versions.
Carbon 2 is officially supported by Laravel since the version 5.8, if you want to use it on a lower version, you can follow those steps:
Set explicitly the Carbon version and add the adapter in your composer.json:
{
"require": {
"nesbot/carbon": "2.21.3 as 1.34.0"
}
}
Related
I tried updating brianium/paratest from ^6.6 to the latest version of ^7.0 and now, when I try to run composer install, I get this message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires vimeo/psalm ^4.29 -> satisfiable by vimeo/psalm[4.29.0, 4.30.0].
- brianium/paratest[v7.0.0, ..., v7.0.1] require phpunit/phpunit ^10.0.3 -> satisfiable by phpunit/phpunit[10.0.3, 10.0.4].
- phpunit/phpunit[10.0.3, ..., 10.0.4] require sebastian/diff ^5.0 -> satisfiable by sebastian/diff[5.0.0].
- Conclusion: don't install sebastian/diff 5.0.0 (conflict analysis result)
- Root composer.json requires brianium/paratest ^7.0 -> satisfiable by brianium/paratest[v7.0.0, v7.0.1].
Error: Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires vimeo/psalm ^4.29 -> satisfiable by vimeo/psalm[4.29.0, 4.30.0].
- brianium/paratest[v7.0.0, ..., v7.0.1] require phpunit/phpunit ^10.0.3 -> satisfiable by phpunit/phpunit[10.0.3, 10.0.4].
- phpunit/phpunit[10.0.3, ..., 10.0.4] require sebastian/diff ^5.0 -> satisfiable by sebastian/diff[5.0.0].
- Conclusion: don't install sebastian/diff 5.0.0 (conflict analysis result)
- Root composer.json requires brianium/paratest ^7.0 -> satisfiable by brianium/paratest[v7.0.0, v7.0.1].
Error: Process completed with exit code 2.
Here's my composer.json:
"require": {
"php": ">=8.1"
},
"require-dev": {
"ext-xml": "*",
"brianium/paratest": "^7.0",
"friendsofphp/php-cs-fixer": "^3.12",
"php-parallel-lint/php-parallel-lint": "^1.3",
"squizlabs/php_codesniffer": "^3.7",
"vimeo/psalm": "^4.29"
},
I'm not requiring sebastian/diff myself so I can't remove it as a requirement. Per the output I guess phpunit/phpunit is but if it were the only thing requiring sebastian/diff then I don't see how there'd be a conflict. So it seems like something else must be requiring sebastian/diff, albeit a different version, but I have no idea what.
I suppose I could look at each my deps and consider upgrading each one of them, as well, but idk... that could be a huuuge PITA if I had a lot of deps. Is there no better way to figure out what's going on?
I did do that for my specific composer.json and it looks like PHP-CS-Fixer/PHP-CS-Fixer (even the latest version of v3.14.3) requires ^4.0 whereas phpunit/phpunit 10.x requires ^5.0 so I guess that's the issue but I feel like I shouldn't need to have to look at each individual repo's composer.json to figure that out.
Just have a look at the requirements of vimeo/psalm. v4 requires sebastian/diff in v3 or v4, as you can see on https://packagist.org/packages/vimeo/psalm#4.29.0, and this is obviously incompatible with PHPUnit v10, as this requires sebastian/diff in v5.
You could check if your application supports running Psalm v5. And if not, this is a great example for why you should not install tools like Psalm using Composer
Also, next time you run such an update, composer why-not could help. In your example, composer why-not brianium/paratest 7.0.1 could have pointed out the incompatible package
following this guide: https://laravel-angular.io/docs/1/jwt-auth-install/ I've installed tymon/jwt-auth:^1.0#dev correctly. It's all okay but, when I run: composer require irazasyed/jwt-auth-guard, this error appears.
composer require irazasyed/jwt-auth-guard
Using version ^1.0 for irazasyed/jwt-auth-guard
./composer.json has been updated
Running composer update irazasyed/jwt-auth-guard
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- irazasyed/jwt-auth-guard[dev-master, v1.0.0, ..., v1.0.4] require illuminate/support ~5.0 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
- irazasyed/jwt-auth-guard 1.0.x-dev is an alias of irazasyed/jwt-auth-guard dev-master and thus requires it to be installed too.
- Root composer.json requires irazasyed/jwt-auth-guard ^1.0 -> satisfiable by irazasyed/jwt-auth-guard[v1.0.0, ..., 1.0.x-dev (alias of dev-master)].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
My PHP version is: 7.4.16;
My Laravel version is: 8.12;
My composer version is: 2.0.9.
I don't know what can I do. Thanks to all for the help!
UPDATE:
This is the error after run composer require irazasyed/jwt-auth-guard --ignore-platform-reqs:
Using version ^1.0 for irazasyed/jwt-auth-guard
./composer.json has been updated
Running composer update irazasyed/jwt-auth-guard
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- irazasyed/jwt-auth-guard[dev-master, v1.0.0, ..., v1.0.4] require illuminate/support ~5.0 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
- irazasyed/jwt-auth-guard 1.0.x-dev is an alias of irazasyed/jwt-auth-guard dev-master and thus requires it to be installed too.
- Root composer.json requires irazasyed/jwt-auth-guard ^1.0 -> satisfiable by irazasyed/jwt-auth-guard[v1.0.0, ..., 1.0.x-dev (alias of dev-master)].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
lcobucci/jwt is a framework-agnostic PHP library that allows you to issue, parse, and validate JSON Web Tokens based on the RFC 7519.
By running the following command you could install it.
composer require lcobucci/jwt
You can find more documentation of it here
https://lcobucci-jwt.readthedocs.io/en/latest/
I'm using the doctrine/dbal (v2.4.*) package in my PHP project. My production server runs PHP v5.6.
I ran composer update this morning which updated my composer.lock file. Now, when I'm deploying to production, I see this:
Problem 1
- Installation request for doctrine/inflector v1.2.0 -> satisfiable by doctrine/inflector[v1.2.0].
- doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.14) does not satisfy that requirement.
Problem 2
- doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.14) does not satisfy that requirement.
- doctrine/common v2.4.3 requires doctrine/inflector 1.* -> satisfiable by doctrine/inflector[v1.2.0].
- Installation request for doctrine/common v2.4.3 -> satisfiable by doctrine/common[v2.4.3].
Specifically these:
doctrine/common v2.4.3 requires doctrine/inflector 1.* -> satisfiable by doctrine/inflector[v1.2.0].
doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version
(5.6.14) does not satisfy that requirement
This means, that even if dbal is old, it requires the newest common, and common requires the newest inflector package. Problem is that inflector started depending on PHP7 to run.
Is there any way in Composer to limit updating of the packages to those supported by specific PHP version? Like saying: "Please update what you can, but only if the server's PHP version is sufficient."
Use the platform option in your composer.json file to define the PHP version your production environment is using like this:
{
"config": {
"platform": {
"php": "5.6.14"
}
}
}
see https://getcomposer.org/doc/06-config.md#platform
Remove composer.lock file
Run composer install
I've been trying to install Google's ClientAPI, but it's got tons of dependency issues. I've searched the web, with no luck whatsoever.
I tried to install the faulty dependencies myself, but they had the same issue. Here's the message I'm getting:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- google/apiclient v2.0.0-RC3 requires guzzlehttp/guzzle 5.2.* -> satisfiable by guzzlehttp/guzzle[5.2.0] but these conflict with your requirements or minimum-stability.
- google/apiclient v2.0.0-RC2 requires guzzlehttp/guzzle 5.2.* -> satisfiable by guzzlehttp/guzzle[5.2.0] but these conflict with your requirements or minimum-stability.
- google/apiclient v2.0.0-RC1 requires guzzlehttp/guzzle 5.2.* -> satisfiable by guzzlehttp/guzzle[5.2.0] but these conflict with your requirements or minimum-stability.
- Conclusion: don't install google/apiclient 2.x-dev
- Conclusion: don't install google/apiclient v2.0.3
- Installation request for phpseclib/phpseclib (locked at 0.3.10) -> satisfiable by phpseclib/phpseclib[0.3.10].
- Conclusion: don't install google/apiclient v2.0.2
- Conclusion: don't install google/apiclient v2.0.1
- google/apiclient v2.0.0 requires google/auth 0.8 -> satisfiable by google/auth[v0.8].
- google/apiclient v2.0.0-RC8 requires google/auth 0.8 -> satisfiable by google/auth[v0.8].
- Conclusion: don't install google/auth v0.8
- Installation request for guzzlehttp/psr7 (locked at 1.4.x-dev) -> satisfiable by guzzlehttp/psr7[1.4.x-dev].
- google/apiclient v2.0.0-RC6 requires google/auth 0.7 -> satisfiable by google/auth[v0.7].
- google/apiclient v2.0.0-RC7 requires google/auth 0.7 -> satisfiable by google/auth[v0.7].
- Conclusion: don't install google/auth v0.7
- google/apiclient v2.0.0-RC4 requires google/auth 0.5 -> satisfiable by google/auth[v0.5].
- google/apiclient v2.0.0-RC5 requires google/auth 0.5 -> satisfiable by google/auth[v0.5].
- Conclusion: don't install google/auth v0.5
- Installation request for google/apiclient ^2.0 -> satisfiable by google/apiclient[2.x-dev, v2.0.0, v2.0.0-RC1, v2.0.0-RC2, v2.0.0-RC3, v2.0.0-RC4, v2.0.0-RC5, v2.0.0-RC6, v2.0.0-RC7, v2.0.0-RC8, v2.0.1, v2.0.2, v2.0.3].
Installation failed, reverting ./composer.json to its original content.
At this point all I can think of is to install ClientAPI outside of composer, but I don't know if it's a good idea or not!
And here's my composer.json file (only the relevant parts):
"minimum-stability": "dev",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"tymon/jwt-auth": "0.5.*",
"barryvdh/laravel-cors": "^0.8.0",
"laravel/socialite": "^2.0",
"guzzlehttp/guzzle": "^6.1",
"intervention/image": "^2.3",
"kozz/laravel-guzzle-provider": "^6.0",
"symfony/psr-http-message-bridge": "^0.2.0",
"fairholm/elasticquent": "dev-feature/laravel-5",
"graham-campbell/flysystem": "^3.3",
"league/flysystem-sftp": "^1.0",
"netshell/paypal": "dev-master",
"facebook/php-sdk-v4": "~5.0"
},
The problem is there is conflict between your old package requirements and you new package requirements.
This is worst part of composer or disadvantage of composer.
you have to manually install a package version which is satisfiable with both package. And trust me it is very hard to do.
I found a solution on GitHub google API PHP client issues and discussion. That actually solve my problem as well. referring to the original post so that it might also save someone's day.
https://github.com/googleapis/google-api-php-client/issues/969
The idea is to simply add "google/apiclient": "^2.0" directly to composer.json and running composer update.
Installation request for phpseclib/phpseclib (locked at 0.3.10)
Installation request for guzzlehttp/psr7 (locked at 1.4.x-dev)
It seems that some packages are "locked at" specific versions (as per your composer.lock).
To see why they're locked, run:
composer why org/package -t
You may try to update these dependencies by:
composer update --with-dependencies
However, if that won't help, consider removing composer.lock and re-run composer install.
Try also your configuration on the empty folder.
To see the installed dependency tree, run:
composer show -t
To see the requirements for the given package, run for example:
composer show -a google/apiclient 2.0.3
This can give some idea what is wrong. To see more verbose output, add -v to your command.
For further troubleshooting the issue, see:
How to resolve a "Can only install one of:" conflict?
How to explain Composer's error log?
I try install https://github.com/google/google-api-php-client for my php project via composer.
composer.json:
{
"require": {
"Intervention/image": "~2.3.7",
"intervention/image": "^2.3",
"guzzlehttp/guzzle": "^6.2"
}
}
I run this command:
composer require google/apiclient:^2.0
And result:
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- google/apiclient v2.0.0 requires google/auth 0.8 -> satisfiable by google/auth[v0.8].
- Installation request for google/apiclient 2.0 -> satisfiable by google/apiclient[v2.0.0].
- Conclusion: remove guzzlehttp/psr7 1.3.0
- Conclusion: don't install guzzlehttp/psr7 1.3.0
- google/auth v0.8 requires guzzlehttp/psr7 1.2.* -> satisfiable by guzzlehttp/psr7[1.2.0, 1.2.1, 1.2.2, 1.2.3].
- Can only install one of: guzzlehttp/psr7[1.2.0, 1.3.0].
- Can only install one of: guzzlehttp/psr7[1.2.1, 1.3.0].
- Can only install one of: guzzlehttp/psr7[1.2.2, 1.3.0].
- Can only install one of: guzzlehttp/psr7[1.2.3, 1.3.0].
- Installation request for guzzlehttp/psr7 (locked at 1.3.0) -> satisfiable by guzzlehttp/psr7[1.3.0].
Installation failed, reverting ./composer.json to its original content.
Also I installed php composer.phar require guzzlehttp/guzzle before...
I would try removing your project's requirement of guzzlehttp/guzzle and let your Google dependency tell composer what version it wants to pull in. Google's package (for some reason) has a version floor of 1.2 for guzzlehttp/psr7, and composer is complaining that it can't figure out how to satisfy this requirement.
Since your new dependency (the Google package) also requires guzzlehttp/guzzle, you don't need to specifically require it, so I would just remove it and try composer update again.