I migrated an application from Zend Framework 3 to Laminas. During the migration, the migration script added the laminas/laminas-dependency-plugin dependency to the composer.json file. After that, I removed this (by running composer remove laminas/laminas-dependency-plugin
). For now there are no errors and all the tests are "green", but nevertheless I would like to be sure that the package was really only needed for the migration and I don't have to expect any trouble caused by this missing package.
Is the laminas/laminas-dependency-plugin package needed after a successful completion of the migration from Zend Framework 3 to Laminas?
laminas/laminas-dependency-plugin
is needed for the case where some of your dependencies want Zend Framework packages. It hooks into composer resolution to rewrite ZF package to its Laminas counterpart.
Each migrated Laminas package provides same versions that were originally released in Zend Framework, and provides composer replace for exact same version of ZF package.
For example, when some of your dependencies want laminas/laminas-stratigility
and some other wants zendframework/zend-stratigility
then composer will install laminas/laminas-stratigility
to satisfy both dependencies. Dependency plugin will have no effect.
However, when some dependency wants zendframework/zend-inputfilter
and nothing wants its Laminas counterpart then composer will install zendframework/zend-inputfilter
. This is where dependency plugin comes into play and rewrites it to laminas/laminas-inputfilter
If nothing is installing zendframework/* packages, you are fine. laminas/laminas-dependency-plugin
is not a hard dependency and you can remove it.
Another compatibility package laminas/laminas-zendframework-bridge
is responsible for dynamically aliasing Zend namespace to Laminas when Zend Framework class autoloading is triggered.
If you are sure nothing in your dependency tree uses Zend Framework packages, you can also remove the bridge package by utilizing replace
in the root composer.json
like this:
"replace": {
"laminas/laminas-zendframework-bridge": "*"
},
Note that this approach is a hack and can potentially break some code unless you tightly control your dependencies. Generally it have negligible impact and removing it won't provide a noticeable benefit.