Article

Zend Framework 2 Maintenance Center

Map ZF2 modules, ServiceManager, and routing so you can plan a verified laminas-migration instead of a blind namespace search-replace.

Zend Framework 2 introduced the modular application layout most teams still recognize: module/ directories, Module.php, and configuration merged through the ServiceManager. If your composer.lock lists zendframework/zendframework or component packages in the 2.x line, this hub is your starting map—and Laminas migration tooling is likely in scope.

Signature ZF2 artifacts

  • config/application.config.php listing modules
  • module/Application/Module.php implementing getConfig() / getServiceConfig()
  • Factories and invokables under service_manager keys
  • Routes in module.config.php under routerroutes
// LEGACY ZF2 module config fragment
return [
    'service_manager' => [
        'factories' => [
            'My\Service\Invoice' => 'My\Factory\InvoiceFactory',
        ],
    ],
    'controllers' => [
        'invokables' => [
            'My\Controller\Invoice' => 'My\Controller\InvoiceController',
        ],
    ],
];

Deep dives in this center

  • Modules — load order, shared config, and module boundaries
  • ServiceManager — factories, aliases, and plugin managers
  • Routing — segment/literal routes and controller resolution
  • ZF2 migration — path into Laminas with backup and testing gates
// MODERN after laminas-migration (namespaces rewritten)
return [
    'service_manager' => [
        'factories' => [
            \My\Service\Invoice::class => \My\Factory\InvoiceFactory::class,
        ],
    ],
];

Do not confuse ZF2 with ZF1

ZF2 apps already use Composer in supported setups. ZF1 trees with a bolted-on composer.json for one library are not the same. Confirm major version before running laminas-migration migrate. Official scope: ZF version 2/3 series (plus Apigility/Expressive)—see Laminas migration docs.

Cross-links: flagship ZF→Laminas guide, import existing PHP project, Composer platform checker.

Related reading