Dealing with Dependencies How to resolve composer package incompatibilities.
Shift does it’s best to note any new version requirements when upgrading your application.
However, for older applications it’s likely that your dependencies will become incompatible.
The process for resolving these dependency conflicts can be a bit tedious. Especially if you’re not familiar with composer.
So you may end up in a situation where you’ve run your Shift and when you go to run
composer install you receive something like this...
The first step is to wade through the output and determine which package is incompatible.
composer will complain more about the dependency it could not satisfy, and not the offending dependency.
If we scroll through we can normally find this at either the very bottom or somewhere in the middle.
Again, by process of elimination we can ignore statements about the Laravel or Illuminate packages as this is part of your upgrade.
Once you determine the package you can use
composer to require it again. Note that if it’s a development dependency you’ll want to add the
As soon as we see the version constraint appear, we can stop composer by pressing Ctrl + C.
This is a little trick to not only save time by preventing composer from trying to install all the dependencies, but also because when composer fails it reverts the updates to your
If you happen to not to catch it in time, you can scroll up and copy the version constraint from the output and manually updated your
Once we make this change we can attempt to run
composer install again. If another package conflicts, repeat this process until
composer install successfully install all of your dependencies.
composer require continues to fail, it is possible that the package dependency is truly incompatible with your upgraded project. You can determine this reviewing the project requirements on Packagist or the project source. Often, if a package no longer supports a recent version it will suggest an alternative package or native functionality which may replace its need.