Showing results for 
Search instead for 
Did you mean: 

Migration of Zend Framework to the Laminas Project

Adobe Team

You may know, the Zend Framework has a new path of development as the Laminas project. Laminas is simply the next step in the evolution of the Zend Framework.  


Today, only the naming and governance of the framework has changed. The Laminas code base: 

  • Will run just like your Zend Framework code because the base is the same. It will just be using the code under new namespaces. 
  • Is now under an open governance model managed by the Linux Foundation. 
  • Will soon be under a technical charter with the Linux Foundation. 

To ensure seamless integrations between all Laminas packages and existing Zend Framework projects — including third-party libraries with Zend Framework code — the project's Technical Steering Committee migrated existing packages to new GitHub repositories.  

Anyone can still install all existing Zend Framework, Apigility, and Expressive packages. However, these versions will no longer be maintained by the community. 

For more information, see the official blog post. 

What does this mean in terms of Magento infrastructure? 


Changes to 2.3.5


The new release of Magento 2.3.5 will contain a few changes to the code and configuration that allow Magento team and extension developers use the Laminas libraries: 

  • Replaced all ZF libraries with Laminas libraries in composer.json files 
  • Added new dependency - laminas/laminas-dependency-plugin 
  • Replaced ZF classes with Laminas classes for the following configuration files: 
    • setup/config/application.config.php 
    • setup/config/di.config.php 
  • Replaced used ZF classes with Laminas classes for the following Magento classes: 
    • \Magento\Setup\Module 
    • \Magento\Setup\Mvc\Bootstrap\InitParamListener 
    • \Zend\Mvc\Controller\LazyControllerAbstractFactory 

We continue to use Zend namespace for \Zend\Mvc\Controller\LazyControllerAbstractFactory to avoid any changes to the autoload section of the root composer.json file. 


Backward-incompatible changes


Our changes are backward compatible and you can continue to use your current code. We recommend extension developers and system integrators to begin migrating their extensions to use Laminas. It's not required for compatibility with the patch release but is required for a long-term solution. 


This backward-compatible solution is based on laminas/laminas-dependency-plugin from Laminas and laminas/laminas-zendframework-bridgelaminas/laminas-dependency-plugin intercepts requests to install packages from the Zend Framework and will replace them with the equivalents from the Laminas Project. laminas/laminas-zendframework-bridge provides a custom autoloader that aliases legacy Zend Framework, Apigility, and Expressive classes to their replacements under the Laminas Project.


Changes to 2.4.0


The same changes for 2.3.5 will apply to 2.4.0: 

In addition: 

  • Replace the use of all Zend Framework 2 classes with Laminas classes (the only difference with 2.3 release line) 

We continue to use Zend namespace for \Zend\Mvc\Controller\LazyControllerAbstractFactory to avoid any changes to the autoload section of the root composer.json file.


Backward-incompatible changes


We have backward incompatible changes for 2 classes: 

  • Magento\Backend\App\Area\FrontNameResolver::_construct - input argument type was changed 
  • Magento\Framework\App\Response\HttpInterface::getHeader - declared return type was changed 


If you do not have a rewrite for Magento\Backend\App\Area\FrontNameResolver and do not depend on the instance class returned from Magento\Framework\App\Response\HttpInterface::getHeader, these changes will not affect your code. 


Recommendations for Extension Developers


Extension developers should check their extensions to ensure that they don’t have rewrites for Magento classes that use Zend Framework 2 classes as method arguments or are direct descendants of Zend Framework 2 classes. If the extension contains such code, extension developers need to apply changes to be compatible with Magento version 2.4.0. 

In most cases, our changes will be backward compatible excepts as described above. 


Changes to technology stack requirements


Due to features of Composer that laminas/laminas-dependency-plugin uses, we require Composer 1.7.0 and up. If you are unsure what version you are on, run `composer --version`. If you are on an older version, run `composer self-update`. 


Additional Notes


If you are interested in full migration of your code to use the Laminas libraries, we recommend the following tool. Here is the official recommendation for migration to Laminas libraries. 

1 Comment