composer: Your requirements could not be resolved to an installable set of packages after moving on php 8 - composer-php

Hi I'm migrate on the PHP 8 and update composer to the version 2. When I tried to update my dependances I got errors:
Your requirements could not be resolved to an installable set of packages
Problem 1
- prooph/service-bus is locked to version v6.2.2 and an update of this package was not requested.
- prooph/service-bus v6.2.2 requires php ^7.1 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 2
- prooph/event-sourcing is locked to version v5.6.0 and an update of this package was not requested.
- prooph/event-sourcing v5.6.0 requires php ^7.1 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 3
- prooph/pdo-event-store is locked to version v1.12.0 and an update of this package was not requested.
- prooph/pdo-event-store v1.12.0 requires php ^7.1 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 4
- prooph/event-store-bus-bridge is locked to version v3.3.0 and an update of this package was not requested.
- prooph/event-store-bus-bridge v3.3.0 requires php ^7.1 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 5
- prooph/snapshotter is locked to version v2.1.0 and an update of this package was not requested.
- prooph/snapshotter v2.1.0 requires php ^7.1 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 6
- prooph/pdo-snapshot-store is locked to version v1.5.2 and an update of this package was not requested.
- prooph/pdo-snapshot-store v1.5.2 requires php ^7.1 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 7
- zendframework/zend-escaper is locked to version 2.6.1 and an update of this package was not requested.
- zendframework/zend-escaper 2.6.1 requires php ^5.6 || ^7.0 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 8
- spatie/ssl-certificate-chain-resolver is locked to version 2.0.3 and an update of this package was not requested.
- spatie/ssl-certificate-chain-resolver 2.0.3 requires php ^7.0 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 9
- phpdocumentor/reflection-docblock is locked to version 4.3.4 and an update of this package was not requested.
- phpdocumentor/reflection-docblock 4.3.4 requires php ^7.0 -> your php version (8.0.1-dev) does not satisfy that requirement.
Problem 10
- paragonie/random_compat v9.99.99 requires php ^7 -> your php version (8.0.1-dev) does not satisfy that requirement.
- ramsey/uuid 3.9.3 requires paragonie/random_compat ^1 | ^2 | 9.99.99 -> satisfiable by paragonie/random_compat[v9.99.99].
- ramsey/uuid is locked to version 3.9.3 and an update of this package was not requested."
As I understand this error mean that some of my packages are not ready for php 8. What can I do to update packages which are ready?
I tried to update composer.json for the prooph components
"require": {
"php": "^7.1",
"prooph/common" : "^4.0.0"
}
to
"require": {
"php": "^7.1 || ^8.0",
"prooph/common" : "^4.0.0"
}
and run command composer.phar update --lock --with-all-dependencies but it's not help
When I tried to update vimeo/psalm by "composer.phar update vimeo/psalm 4.4" I got the same error. Does it mean that prooph require old version of psalm and it not allow to update it?
How to resolve this problem and update all which are ready?
My composer.json file:
{
"require": {
"php-amqplib/php-amqplib": ">=2.8",
"prooph/service-bus": "^6.2",
"prooph/event-sourcing": "^5.6",
"prooph/event-store": "^7.5",
"prooph/pdo-event-store": "^1.10",
"prooph/event-store-bus-bridge": "^3.3",
"prooph/snapshotter": "^2.1",
"prooph/pdo-snapshot-store": "^1.5",
"psr/container": "^1.0",
"zendframework/zend-escaper": "^2.6",
"spatie/ssl-certificate-chain-resolver": "^2.0",
"webmozart/glob": "^4.1",
"webmozart/path-util": "^2.3",
"webmozart/assert": "^1.5",
"vimeo/psalm": "^3.5.1",
"sebastian/diff": "^3.0",
"psr/log": "^1.1",
"phpdocumentor/type-resolver": "^1.0",
"phpdocumentor/reflection-docblock": "^4.3",
"phpdocumentor/reflection-common": "^2.0",
"openlss/lib-array2xml": "^1.0",
"ocramius/package-versions": "^1.4",
"nikic/php-parser": "^4.2",
"netresearch/jsonmapper": "^1.6",
"felixfbecker/language-server-protocol": "^1.4",
"felixfbecker/advanced-json-rpc": "^3.0",
"composer/xdebug-handler": "^1.3",
"amphp/byte-stream": "^1.6",
"amphp/amp": "^2.2",
"symfony/service-contracts": "^1.1",
"symfony/polyfill-php73": "^1.11",
"symfony/polyfill-mbstring": "^1.11",
"symfony/polyfill-ctype": "^1.12",
"symfony/console": "^4.3",
"ramsey/uuid": "^3.8",
"ext-json": "*",
"ext-openssl": "*",
"ext-mysqli": "*",
"ext-dom": "*",
"ext-curl": "*",
"ext-pcntl": "*",
"ext-posix": "*",
"symfony/http-foundation": "^5.1",
"symfony/routing": "^5.1",
"ocramius/proxy-manager": "^2.2",
"react/promise": "^2.8",
"psr/event-dispatcher": "^1.0",
"ext-ftp": "*",
"ext-iconv": "*"
},
"autoload": {
"classmap": [
"vendor/acme_nc/ACMECert.php",
"vendor/roundcube/roundcubeAutoLogin.php"
]
}
}

Pretty simple, the following two lines tell it all:
prooph/service-bus is locked to version v6.2.2 and an update of this package was not requested.
prooph/service-bus v6.2.2 requires php ^7.1 -> your php version (8.0.1-dev) does not satisfy that requirement.
According to that package's information, there is no version compatible with PHP 8. And as written in a blog post by one of the maintainers, there will be no new versions of this package.
Updating the other packages should be possible by updating your composer.json. As you haven't shared the current state of your configuration, it's not possible to tell you what you need to change, but the most simplest way is taking one line after the other, check for updates on packagist.org, and adjust the version constraint. But be warned that it's pretty likely that you run some major upgrades. Having a good test suite helps to check which upgrades cause which problems

Related

php 8.2 + laravel 9 failed with composer error that cron-expression does not match the constraint

I am updating laravel to use php 8.2, according to laravel document here, using "laravel/framework": "^9.43" should be enough.
My composer.json are the following,
"require": {
"php": "^8.2",
"clue/socket-raw": "^1.3",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"gregwar/captcha": "1.*",
"guzzlehttp/guzzle": "^7.0.1",
"itsgoingd/clockwork": "^5.1",
"jacobcyl/ali-oss-storage": "^2.0",
"james-heinrich/getid3": "^1.9",
"laravel/framework": "^9.43",
"laravel/horizon": "^5.7",
"laravel/tinker": "^2.5",
"php-curl-class/php-curl-class": "^8.6"
},
But when running composer install --no-scripts --no-autoloader --no-dev (I don't use composer.lock here), composer complained,
laravel/framework[v9.43.0, ..., 9.x-dev] require dragonmantank/cron-expression ^3.3.2 -> found
dragonmantank/cron-expression[dev-set-up-semaphore,
dev-update-v3-php8, dev-master, dev-issue/35-fix-and-or-problem,
dev-allow-phpstan-failures, v1.0.0, ..., v1.2.1, v2.0.0, ...,
v2.3.1.x-dev, v3.0.0, ..., v3.3.1] but it does not match the
constraint.
I know laravel/framework 9 requires cron-expression ^3.3.2 as https://packagist.org/packages/laravel/framework said. But I can't figure out which other package requires a different version of cron-expression. I search the old composer.lock (which I don't use when install) I find multi-mention of dev-master, but no [dev-set-up-semaphore, dev-update-v3-php8, dev-issue/35-fix-and-or-problem, dev-allow-phpstan-failures]
Please check the following build log
How do I find that package ? BTW, php 8.1.7 + "laravel/framework" 8 works fine.
--- update ---
I find the reason why composer complains.
I have "require-dev" in my composer and all packages in it use the latest versions! I also check https://packagist.org/ to make sure they all say they support ^8.0. Besides, my command is composer install --no-scripts --no-autoloader --no-dev, no-dev !
So I didn't expect "require-dev" will cause problem. But only after I remove the "require-dev" did composer run successfully!
Apparently one of those packages do not support php 8.2 yet.
"require-dev": {
"facade/ignition": "^2.17",
"fakerphp/faker": "^1.21.0",
"laravel/sail": "^1.18.1",
"mockery/mockery": "^1.5.1",
"nunomaduro/collision": "^6.4",
"phpunit/phpunit": "^9.5.28"
}
After removing "facade/ignition" from "require-dev", composer finally works!
As for why does "facade/ignition" cause the problem and what is the solution for it, please refer to #NicoHaase's answer and my discussion with him.
"Apparently one of those packages do not support php 8.2 yet." - no, that's not the cause. Ignition does not support Laravel v9, as written in their readme:
If you're on Laravel 8 or above, you can switch to spatie/laravel-ignition, which is a drop-in replacement. Replace facade/ignition with "spatie/laravel-ignition": "^1.0" in your application's composer.json file.
Going forward, we'll only add security fixes to facade/ignition and highly encourage you to switch to spatie/laravel-ignition.
Use composer's why-not command:
composer why-not laravel/framework 9.43

missing 'ext-gd' in laravel 7

Error missing 'ext-gd' in laravel 7 when run composer u command.
D:\wamp64\www\ranking-master>composer u
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- mpdf/mpdf[v8.0.0-RC1, ..., v8.0.3] require php ^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 -> your php version (8.1.12) does not satisfy that requirement.
- mpdf/mpdf[v8.0.4, ..., v8.0.7] require php ^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 -> your php version (8.1.12) does not satisfy that requirement.
- mpdf/mpdf[v8.0.8, ..., v8.0.9] require php ^5.6 || ^7.0 -> your php version (8.1.12) does not satisfy that requirement.
- mpdf/mpdf[v8.0.10, ..., v8.0.12] require php ^5.6 || ^7.0 || ~8.0.0 -> your php version (8.1.12) does not satisfy that requirement.
- mpdf/mpdf[v8.0.13, ..., v8.1.4] require ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
- niklasravnsborg/laravel-pdf[v4.0.0, ..., v4.1.0] require mpdf/mpdf ^8.0 -> satisfiable by mpdf/mpdf[v8.0.0-RC1, ..., v8.1.4].
- Root composer.json requires niklasravnsborg/laravel-pdf ^4.0 -> satisfiable by niklasravnsborg/laravel-pdf[v4.0.0, v4.1.0].
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-gd` to temporarily ignore these required extensions.
D:\wamp64\www\ranking-master>php --ini`enter code here`
Configuration File (php.ini) Path:
Loaded Configuration File: C:\xampp\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
D:\wamp64\www\ranking-master>composer --ignore-platform-req=ext-gd
file composer.json
"require": {
"php": "^8.1.12",
"awssat/laravel-visits": "^3.0",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "^2.6",
"kavenegar/php": "^1.2",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"maatwebsite/excel": "^3.1",
"morilog/jalali": "3.\*",
"niklasravnsborg/laravel-pdf": "^4.0",
"orangehill/iseed": "^3.0",
"tucker-eric/eloquentfilter": "^2.4",
"tymon/jwt-auth": "^1.0"
}
hi. i try to run composer u and update packages but show me error !
The project's PHP was 7 and I manually changed it to PHP 8
please help me.
a 3rd party package requires a specific extension to be enabled
mpdf/mpdf[v8.0.13, ..., v8.1.4] require ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
try install it first and run composer u again

Update from Laravel 5.5 to 6

I am trying to update the Laravel5.5 project to 6.
What I tried is first describing the package update
"php": "^7.2",
"ext-SimpleXML": "^7.3",
"barryvdh/laravel-ide-helper": "^2.6",
"doctrine/dbal": "^2.10",
"fideloper/proxy": "^4.0",
"jeroennoten/laravel-adminlte": "^2.0",
"laravel/framework": "^6.0",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^6.0",
"maatwebsite/excel": "^3.1",
"laravel/ui": "^1.1",
"phpoffice/phpspreadsheet": "^1.9",
"phpoffice/phpexcel": "dev-master"
next
composer update
I get error
Call to undefined function str_slug()
So install this library
composer require laravel/helpers
Then this error came out
JeroenNoten \ LaravelAdminLte \ ServiceProvider :: class, not found
Reinstalling adminLTE doesn't help, commenting out and reinstalling doesn't work, I'm stuck and want help
I need help
Click here to resolve this error: Call to undefined function str_slug()
Remove space in config/app.php file:
'providers' => [
....
JeroenNoten\LaravelAdminLte\ServiceProvider::class,
],
Just run this command, It can automatically add all configurations to your project:
composer require jeroennoten/laravel-adminlte
More info about jeroennoten/laravel-adminlte
Open the composer.json file of your project (The configuration file of Composer) and change the Laravel framework . (Notice the caret, Laravel 6 makes use of semantic versioning scheme).
you are recommended to first upgrade your project to 5.8 then again upgrade to v6.
Next, save your composer.json file and run the following command:
$ composer update
Before you upgrade your project to v6, make sure your upgrade your PHP version from 7.1 to at least 7.2.
starting from December 2019, PHP 7.1 will not be maintained.

laravel upgrade to 5.7 from 5.6 composer not working

I am upgrading my laravel project to 5.6. current version is 5.5.38. my composer file is as below. when i run composer update, it does nothing but showing Loading composer repositories with package information
Updating dependencies (including require-dev) in the terminal for hours. what would be the issue for this?
"require": {
"php":">=7.1.3",
"laravel/framework": "5.6.*",
"fideloper/proxy" : "^4.0",
"guzzlehttp/guzzle": "~6.0",
"maatwebsite/excel": "v2.1.*",
"itsgoingd/clockwork": "1.*",
"barryvdh/laravel-ide-helper": "^2.2",
"anchu/ftp": "dev-master",
"pda/pheanstalk": "~3.0",
"nesbot/carbon": "1.20",
"laravelcollective/html": "~5.0",
"pusher/pusher-php-server": "~3.0",
"regulus/activity-log": "0.6.*",
"laravel/tinker": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~7.0",
"phpspec/phpspec": "~2.1",
"laracasts/generators": "^1.1",
"symfony/dom-crawler": "~3.1",
"symfony/css-selector": "~3.1",
"filp/whoops" : "~2.0"
},
The original poster fixed this by upgrading PHP, but for others (at time of writing, Laravel 5.5 is still the LTS version, so there will be many people upgrading from that soon), should Composer hang forever (as it did for me, despite running PHP 7.3):
A tip is to remove the entire require-dev section (the one that is only used on your dev environment) and see if it works, than add the packages back in again one at a time – on doing that, you might get an error like this with subsequent Composer commands (or more specifically, the Artisan commands, such as clear-compiled, that are launched by Composer):
In Application.php line 637:
Class 'Laracasts\Generators\GeneratorsServiceProvider' not found
…in which case, you probably need to comment out the appropriate line in app/Providers/AppServiceProvider.php::register() - also, try composer dump-autoload.
Another very useful option: composer-update --no-scripts
Laravel 5.6 now uses Symfony 4, not 3 (so you might switch to "~4.3")
There are some Symfony 4 requirements: https://symfony.com/doc/4.2/reference/requirements.html
Commit your existing copies of composer.json and composer.lock before you start, to make it easy to see what you've changed.

Cant install blocktrail/blocktrail-sdk with composer on laravel project

The problem is
I require blocktrail/blocktrail-sdk with composer on my laravel project and get these errors
Using version ^3.2 for blocktrail/blocktrail-sdk
./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
- Installation request for paragonie/random_compat (locked at v9.99.99) -> satisfiable by paragonie/random_compat[v9.99.99].
- blocktrail/blocktrail-sdk v3.2.0 requires bitwasp/bitcoin v0.0.34.1 -> satisfiable by bitwasp/bitcoin[v0.0.34.1].
- blocktrail/blocktrail-sdk v3.2.1 requires bitwasp/bitcoin v0.0.34.1 -> satisfiable by bitwasp/bitcoin[v0.0.34.1].
- blocktrail/blocktrail-sdk v3.2.2 requires bitwasp/bitcoin v0.0.34.1 -> satisfiable by bitwasp/bitcoin[v0.0.34.1].
- Conclusion: don't install bitwasp/bitcoin v0.0.34.1
- Installation request for blocktrail/blocktrail-sdk ^3.2 -> satisfiable by blocktrail/blocktrail-sdk[v3.2.0, v3.2.1, v3.2.2].
Installation failed, reverting ./composer.json to its original content.
COMPOSER.JSON require and require-dev contents
"require": {
"php": "^7.1.3",
"bitwasp/bitcoin": "^0.0.34.1",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.0",
"laravel/framework": "5.7.*",
"laravel/socialite": "^3.1",
"laravel/tinker": "^1.0",
"paragonie/random_compat": "^2.0.0"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
},
What can I do ? I tried everything , no point
linux debian 8, php 7.2.9, laravel 5.7.5, thanks *
You need to redo some work here because it's a mess in dependencies where versions require symfony 3 and 4 at the same time (which will generate a conflict, that is not obvoius from the message you're getting right now). Same goes for deps for php 5.6 and 7.1 which are not fully compatible.
blocktrail-sdk-php already requires bitwasp/bitcoin, no need to add it in your own composer.json
https://github.com/blocktrail/blocktrail-sdk-php/blob/master/composer.json#L36
blocktrail-sdk-php also requires 99designs/http-signatures-guzzlehttp
which requires
"symfony/http-foundation": "~2.8|~3.0",
and then, you are requiring a newer http-foundation ("^4.1") in another package, specifically laravel-framework (check composer.lock)
I think your best option is to review what you actually want, review composer.json and create it again from scratch starting from the most important package.
Please start from the most important package, and match the versions to it starting from there. You'll have to review composer.json "require" node for every dependency package you need, and sometimes use some older package release (some of them are already made for symfony 4.X while some of your requirements can only handle 3.X). On github, you can easily switch to older revisions via dropdown on the top when you review composer.json to older version until the "require" matches your own dependency versions.
Please be aware you might have to prepare forks of the specific repos to make the adjustments.
If you're doing an update, remember to submit a PR with the package update, so programmers later don't have to fight the same thing :)

Resources