Description
Here's how to reproduce the issue I am facing with, and face once a year whenever it's time to upgrade to a new major version of Laravel.
First, create a new project based on Laravel Framework 8
composer create-project --prefer-dist laravel/laravel test-project "^8"
This also runs composer install
all good so far
cd test-project
composer require spatie/laravel-backup
This attempts to install a version which is incompatible with Laravel 8. It attempts to install a version that requires Laravel 9
$ composer require spatie/laravel-backup
Using version ^8.1 for spatie/laravel-backup
./composer.json has been updated
Running composer update spatie/laravel-backup
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- spatie/laravel-backup[8.1.0, ..., v8.x-dev] require illuminate/console ^9.0 -> found illuminate/console[v9.0.0-beta.1, ..., 9.x-dev] but these were not loaded, likely because it conflicts with another require.
- spatie/laravel-backup[8.1.6, ..., 8.1.9] require illuminate/console ^9.0|^10.0 -> found illuminate/console[v9.0.0-beta.1, ..., 9.x-dev, v10.0.0, ..., 10.x-dev] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires spatie/laravel-backup ^8.1 -> satisfiable by spatie/laravel-backup[8.1.0, ..., v8.x-dev].
You can also try re-running composer require with an explicit version constraint, e.g. "composer require spatie/laravel-backup:*" to figure out if any version is installable, or "composer require spatie/laravel-backup:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
At this point, I need to open up the Github repository for spatie/laravel-backup
and figure out which is the last version to support Laravel 8.
Or I can make a guess. In this case the version I need is ^7
So I run composer require spatie/laravel-backup ^7
And all is good.
I assume this is actually an issue with the dependency? But this happens a lot, it happens all the time.
This happens every time I upgrade to a new major version, I have to do this dozens of times for dozens of dependencies that all have this same problem.
So I'm really looking for a tool, or a command, that will automate detecting what is the highest compatible version of a package with my current installation.
Really hoping there is an online tool or project or anything that can help with this reoccurring problem.
Many thanks!