zendframework/zend-modulemanager
Zend Framework’s ModuleManager helps organize and load application modules with dependency resolution, configuration merging, and event-driven initialization. It supports module discovery, autoloading, and predictable bootstrapping for modular ZF apps.
This package is part of the legacy Zend Framework ecosystem and is archived—use only if maintaining older ZF2 or early Laminas projects. For day-to-day use, you’ll interact with it in config/modules.config.php and module directories (e.g., config/, Module.php). Start by inspecting config/application.config.php (ZF2) or config/modules.config.php (Laminas) to see enabled modules. The core concept is that each module registers configuration, services, and event listeners via its Module.php class—implement methods like getConfig(), getAutoloaderConfig(), and onBootstrap(MvcEvent $e).
config/module.config.php, merged via getConfig() in Module.php. Merge order: application config → module configs (alphabetical by module name unless overridden).getServiceConfig() in Module.php to define factories, invokables, and deinters. Prefer factories for type-hinted dependencies.onBootstrap() to attach global listeners (e.g., for authentication, translation setup) or module-specific MVC events (e.g., MvcEvent::EVENT_ROUTE).ModuleManager in CLI tools via ApplicationInterface—common in ZF2-era admin panels or console modules.ModuleManager::loadModules() hooks—check \ModuleManager::getLocator()->get('ModuleManager') in older code.laminas-modulemanager only if upgrading ZF2 to Laminas MVC—but modern apps should use Laminas laminas-servicemanager + PSR-11 directly.getAutoloaderConfig() often uses Zend\Loader\ClassMapAutoloader or spl_autoload_register callbacks. Confirm autoloading paths in composer.json’s autoload section too—this package does not replace Composer autoloading.view_manager settings). Use config_glob_paths or config_cache_enabled to debug merged config issues.EventManager events in onBootstrap() can cause duplicate handlers if multiple modules attach to MvcEvent::EVENT_DISPATCH. Always use unique identifiers or check for existing listeners.ServiceManager aliases like Zend\Db\Adapter\AdapterInterface require manual mapping in getServiceConfig()—modern apps should use laminas-db’s PSR-11 support.How can I help you explore Laravel packages today?