Published under PHP.
Many PHP package developers place strict version requirements on their packages. For example, the
spatie/laravel-permission package has:
Which means it requires the version of the
illuminate packages to be at least
5.8 but not above or equal to
8.0. So when Laravel 8.0 comes out, the developers of the package will need to update their composer version requirements before users can update to Laravel 8.0.
They do this to ensure their package works with the new version, which is fair enough if the package developers are active and quick to update their packages.
However, when you use a package that doesn't have an active maintainer, or the maintainer is not quick to update their package, you're stuck with not being able to update your dependencies.
Composer provides a quick work around that allows you to update your dependencies without Composer complaining about version mismatches. You can use aliases to tell Composer to think a dependency is actually a different version than what is being installed. Here's an example:
The above will instruct Composer to pull down the
8.x-dev branch from Github but pretend that it is actually version
7.6.1. This will allow Composer to install the dependency even though other dependencies may explicitly require version 7.x of
It should be noted that this solution can lead to issue of its own. Even though Composer will install the dependencies correctly, the dependencies may no longer work well together. You should ensure you have adequate tests setup if you use aliases.
You can read more about aliases on the Composer website: https://getcomposer.org/doc/articles/aliases.md
Subscribe to my newsletter to know when I publish more content in the future.