Main application class for invoking applications
Expects the user will provide a configured ServiceManager, configured with the following services:
The most common workflow is: <code> $services = new ZendServiceManagerServiceManager($servicesConfig); $app = new Application($appConfig, $services); $app->bootstrap(); $response = $app->run(); $response->send(); </code>
bootstrap() opts in to the default route, dispatch, and view listeners, sets up the MvcEvent, and triggers the bootstrap event. This can be omitted if you wish to setup your own listeners and/or workflow; alternately, you can simply extend the class to override such behavior.
Bootstrap the application
Defines and binds the MvcEvent, and passes it the request, response, and router. Attaches the ViewManager as a listener. Triggers the bootstrap event.
Return type: | Application |
---|
Retrieve the service manager
Return type: | ServiceManager |
---|
Set the event manager instance
Parameters: | EventManagerInterface – |
---|---|
Return type: | Application |
Retrieve the event manager
Lazy-loads an EventManager instance if none registered.
Return type: | EventManagerInterface |
---|
Static method for quick and easy initialization of the Application.
If you use this init() method, you cannot specify a service with the name of ‘ApplicationConfig’ in your service manager config. This name is reserved to hold the array from application.config.php.
The following services can only be overridden from application.config.php:
All other services are configured after module loading, thus can be overridden by modules.
Parameters: | array – |
---|---|
Return type: | Application |
Run the application
Return type: | ResponseInterface |
---|
@deprecated