laminas/laminas-mvc
Laminas MVC is a modular, event-driven MVC framework for PHP applications. It provides routing, controllers, view integration, dependency injection, and configuration management, helping you build scalable, maintainable web apps and APIs on top of Laminas components.
Start by installing the package via Composer: composer require laminas/laminas-mvc. This package provides the core MVC infrastructure for Laminas applications—including the Application, MvcEvent, and controller infrastructure. Your first use case will likely be bootstrapping a basic MVC application: create a minimal config/application.config.php with module metadata and controller mappings, then define routes and controllers to handle requests. Check the config/modules.config.php to ensure Laminas\Mvc is listed, and verify your public/index.php initializes the application using Laminas\Mvc\Application::init(). The Laminas\Mvc\Controller\AbstractActionController is the typical base class for controllers—extend it and implement indexAction() to render your first route.
MvcEvent lifecycle events (EVENT_ROUTE, EVENT_DISPATCH, EVENT_RENDER) in Module::onBootstrap() to inject logic like authentication checks or logging.forward(), redirect(), flashMessenger()) inside controllers for common tasks—register custom plugins via PluginManager configuration.UserService) into controllers via constructor or setter injection, configured in Module.php's getServiceConfig().Module.php, enabling reusable and decoupled domain logic.AbstractRestfulController for APIs, implementing getList(), get(), create(), etc., and return JsonModel responses natively.post() action—ensure route definitions (e.g., in module.config.php) align with intended HTTP verbs.Controller, and actions with Action; case-sensitive autoloading in Linux environments can cause 404s if naming mismatches occur.controllers and controller_plugins sections of the ServiceManager config—omitting this yields "service not found" errors at runtime.MvcEvent::EVENT_DISPATCH—always guard with event name !== 'dispatch' or check if already dispatched. invokables in config/autoload/local.php for controllers requiring dependencies—AbstractActionController is not invokable if you add constructor arguments.laminas/laminas-api-tool or mezzio (Laminas’s PSR-7/15-based microframework) for modern HTTP handling.How can I help you explore Laravel packages today?