- July 19, 2024
- by Waqar Haider
- Uncategorized
- 0 Comments
Upgrading a Zend Framework 1 (ZF1) application to Zend Framework 3 (ZF3) is a significant task, as there were many changes and improvements between these versions. While ZF1 was modular there was a global confugration file call application.ini that looks something like this:
Since ZF2, we have no ini file and the application has a modular structure with each module having its own config file namely, module.config.php. This files is located in the module/{module_name}/config/ directory. this has all the related configuration parameters as a nested array. So when upgrading from ZF1 we need to have this structure.
There is global Configuration in the main config directory of the application that can be used to control the application global configuration. But now there are multiple files and each can be used for different purposes.
These files are loaded when the application starts and developer can add their own files according to their environment: the structure look something like this:
Some of the ini file can be used here but not all since it will only be used for global project setup.The other items like routes, views, layout, etc. files are configured in module.config.php file in each module.
ZF1 controllers extend Zend_Controller_Action
. In ZF3, controllers extend Zend\Mvc\Controller\AbstractActionController
.
So for migration we will have to replace each of these Controllers with new ones. That is manual process and each needs to be added accordingly.
ZF1 view scripts are in application/views/scripts
. In ZF3, they are in module/Application/view
.
Move view scripts to the appropriate directory in ZF3 and update any deprecated helper usage.