I'm trying to update yii2 to a newer version using composer, and i just updated my composer to latest version and after i run composer require "yiisoft/yii2:~2.0.49" --update-with-dependencies
i got the below error
Problem 1
- codeception/module-yii2 is locked to version 1.1.5 and an update of this package was not requested.
- codeception/module-yii2 1.1.5 requires php >=5.6.0 <=8.1 | ~8.1.0 -> your php version (8.2.3) does not satisfy that requirement.
Problem 2
- symfony/browser-kit is locked to version v4.2.4 and an update of this package was not requested.
- symfony/browser-kit v4.2.4 requires php ^7.1.3 -> your php version (8.2.3) does not satisfy that requirement.
Problem 3
- lcobucci/jwt 3.3.3 requires php ^5.6 || ^7.0 -> your php version (8.2.3) does not satisfy that requirement.
- sizeg/yii2-jwt v2.0.2 requires lcobucci/jwt ~3.3.0 -> satisfiable by lcobucci/jwt[3.3.3].
- sizeg/yii2-jwt is locked to version v2.0.2 and an update of this package was not requested.
i've being struggling now for few hours and i also try to run composer update
but i got errors as well. how can i update the codeception/module-yii2? and also upgrade my yii2 version? thanks in advance to any help
The problem is in package sizeg/yii2-jwt
.
It's latest release requires lcobucci/jwt: ~3.3.0
. But that package even in 3.4.x version doesn't support php 8.
You have 3 options:
1. Run your app on php 7.4
Yii 2.0.49 does support php 7.4 so composer update should be fine on that php version.
2. You can force composer to install packages for php 7.4 while running app on php 8.2
You will have to hope that everything will work fine. You can do it by setting target platform in composer.json like this:
{
"config": {
"platform": {
"php": "7.4.33"
}
}
}
If you do this the composer will ignore the current php version and instead install packages as if it was running on specified php version. This is probably bad idea especially if your production environment runs php 8.2 too. It might be ok if your production environment runs php 7.4 but you don't want to install old php in your dev environment.
3. You can give up on sizeg/yii2-jwt
and use newer version of lcobucci/jwt
directly
In that case you will simply need to update the other two packages mentioned in composer output (codeception/module-yii2
and symfony/browser-kit
) to version that supports php 8.2. Running composer update
after replacing the outdated sizeg/yii2-jwt
requirement with latest lcobucci/jwt
requirement should take care of updating them.
NOTE
You can always use --dry-run
option with composer
commands if you want to check what is going to happen. Using that option will make composer output the changes that would be done without actually doing any changes to installed packages.