Hace ya un tiempo se gestaron cambios en Zend, ahora es Láminas y el soporte a Zend Framework tal y lo conocíamos ha caducado, ahora el Framework es Mezzio.
Esta es la equivalencia de los nuevos paquetes, la mayoría de cambios son solo de namespaces:
- zendframework/zend-auradi-config => laminas/laminas-auradi-config
- zendframework/zend-cache => laminas/laminas-cache
- zendframework/zend-code => laminas/laminas-code
- zendframework/zend-component-installer => laminas/laminas-component-installer
- zendframework/zend-config-aggregator => laminas/laminas-config-aggregator
- zendframework/zend-db => laminas/laminas-db
- zendframework/zend-debug is abandoned, you should avoid using it. No replacement was suggested.
- zendframework/zend-diactoros => laminas/laminas-diactoros
- zendframework/zend-escaper => laminas/laminas-escaper
- zendframework/zend-eventmanager => laminas/laminas-eventmanager
- zendframework/zend-expressive => mezzio/mezzio
- zendframework/zend-expressive-aurarouter => mezzio/mezzio-aurarouter
- zendframework/zend-expressive-authentication => mezzio/mezzio-authentication
- zendframework/zend-expressive-authentication-oauth2 => mezzio/mezzio-authentication-oauth2
- zendframework/zend-expressive-csrf => mezzio/mezzio-csrf
- zendframework/zend-expressive-flash => mezzio/mezzio-flash
- zendframework/zend-expressive-helpers => mezzio/mezzio-helpers
- zendframework/zend-expressive-router => mezzio/mezzio-router
- zendframework/zend-expressive-session => mezzio/mezzio-session
- zendframework/zend-expressive-session-ext => mezzio/mezzio-session-ext
- zendframework/zend-expressive-template => mezzio/mezzio-template
- zendframework/zend-expressive-tooling => mezzio/mezzio-tooling
- zendframework/zend-httphandlerrunner => laminas/laminas-httphandlerrunner
- zendframework/zend-problem-details => mezzio/mezzio-problem-details
- zendframework/zend-servicemanager => laminas/laminas-servicemanager
- zendframework/zend-stdlib => laminas/laminas-stdlib
- zendframework/zend-stratigility => laminas/laminas-stratigility
- zfcampus/zf-composer-autoloading => laminas/laminas-composer-autoloading
- zfcampus/zf-development-mode => laminas/laminas-development-mode
El proceso de actualización es bastante sencillo y automático, lo unico que necesitamos es el paquete para la migración, que instalaremos con composer
# composer global require laminas/laminas-migration
Changed current directory to /root/.composer
Using version ^1.1 for laminas/laminas-migration
./composer.json has been created
Loading composer repositories with information
Updating dependencies (including require-dev)
operations: 7 installs, 0 updates, 0 removals
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/service-contracts (v2.0.1): Loading from cache
- Installing symfony/polyfill-php73 (v1.14.0): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.14.0): Downloading (100%)
- Installing symfony/console (v5.0.5): Downloading (100%)
- Installing laminas/laminas-zendframework-bridge (1.0.1): Downloading (100%)
- Installing laminas/laminas-migration (1.1.0): Downloading (100%)
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
symfony/console suggests installing symfony/process
symfony/console suggests installing psr/log (For using the console logger)
Writing lock file
Generating autoload files
Luego debemos asegurarnos que el directorio de composer está en el path
# composer global config home
Changed current directory to /root/.composer
/root/.composer
# export PATH=/root/.composer/vendor/bin:$PATH
Y ejecutamos el asistente
# laminas-migration migrate -e data
Migrating project at path "/usr/share/nginx/html/api" to Laminas
================================================================
Injecting laminas-dependency-plugin into composer.json
Performing migration replacements
Injecting Laminas\ZendFrameworkBridge\ConfigPostProcessor into /usr/share/nginx/html/api/config/config.php
[OK] Migration complete!
Next steps:
- Perform a diff to verify the changes made.
- Run "composer install".
- Run any tests (unit tests, integration tests, end-to-end tests, etc.).
Es muy importante el parámetro -e porque aqui debemos incluir todos nuestros directorios de datos que no contengan código (imágenes, backups, etc...), porque de no hacerlo tendremos error de memoria.
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 285822984 bytes)
in /root/.composer/vendor/laminas/laminas-zendframework-bridge/src/Replacements.php on line 30
Comentarios