PHP Класс Zend\Mvc\Application
Expects the user will provide a configured ServiceManager, configured with
the following services:
- EventManager
- ModuleManager
- Request
- Response
- RouteListener
- Router
- DispatchListener
- ViewManager
The most common workflow is:
$services = new Zend\ServiceManager\ServiceManager($servicesConfig);
$app = new Application($appConfig, $services);
$app->bootstrap();
$response = $app->run();
$response->send();
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.
Показать файл
Открыть проект
Примеры использования класса
Защищенные свойства (Protected)
Открытые методы
Метод |
Описание |
|
__construct ( Zend\ServiceManager\ServiceManager $serviceManager, Zend\EventManager\EventManagerInterface $events = null, Zend\Stdlib\RequestInterface $request = null, Zend\Stdlib\ResponseInterface $response = null ) |
Constructor |
|
bootstrap ( array $listeners = [] ) : Application |
Bootstrap the application |
|
getConfig ( ) : array | object |
Retrieve the application configuration |
|
getEventManager ( ) : Zend\EventManager\EventManagerInterface |
Retrieve the event manager |
|
getMvcEvent ( ) : MvcEvent |
Get the MVC event instance |
|
getRequest ( ) : Zend\Stdlib\RequestInterface |
Get the request object |
|
getResponse ( ) : Zend\Stdlib\ResponseInterface |
Get the response object |
|
getServiceManager ( ) : Zend\ServiceManager\ServiceManager |
Retrieve the service manager |
|
init ( array $configuration = [] ) : Application |
Static method for quick and easy initialization of the Application. |
|
run ( ) : self |
Run the application |
|
setEventManager ( Zend\EventManager\EventManagerInterface $eventManager ) : Application |
Set the event manager instance |
|
Защищенные методы
Метод |
Описание |
|
completeRequest ( MvcEvent $event ) : Application |
Complete the request |
|
Описание методов
__construct()
публичный Метод
public __construct ( Zend\ServiceManager\ServiceManager $serviceManager, Zend\EventManager\EventManagerInterface $events = null, Zend\Stdlib\RequestInterface $request = null, Zend\Stdlib\ResponseInterface $response = null ) |
$serviceManager |
Zend\ServiceManager\ServiceManager |
|
$events |
Zend\EventManager\EventManagerInterface |
|
$request |
Zend\Stdlib\RequestInterface |
|
$response |
Zend\Stdlib\ResponseInterface |
|
bootstrap()
публичный Метод
Defines and binds the MvcEvent, and passes it the request, response, and
router. Attaches the ViewManager as a listener. Triggers the bootstrap
event.
public bootstrap ( array $listeners = [] ) : Application |
$listeners |
array |
List of listeners to attach. |
Результат |
Application |
|
completeRequest()
защищенный Метод
Triggers "render" and "finish" events, and returns response from
event object.
protected completeRequest ( MvcEvent $event ) : Application |
$event |
MvcEvent |
|
Результат |
Application |
|
getConfig()
публичный Метод
Retrieve the application configuration
getEventManager()
публичный Метод
Lazy-loads an EventManager instance if none registered.
public getEventManager ( ) : Zend\EventManager\EventManagerInterface |
Результат |
Zend\EventManager\EventManagerInterface |
|
getMvcEvent()
публичный Метод
Get the MVC event instance
getRequest()
публичный Метод
public getRequest ( ) : Zend\Stdlib\RequestInterface |
Результат |
Zend\Stdlib\RequestInterface |
|
getResponse()
публичный Метод
public getResponse ( ) : Zend\Stdlib\ResponseInterface |
Результат |
Zend\Stdlib\ResponseInterface |
|
getServiceManager()
публичный Метод
Retrieve the service manager
public getServiceManager ( ) : Zend\ServiceManager\ServiceManager |
Результат |
Zend\ServiceManager\ServiceManager |
|
init()
публичный статический Метод
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:
- ModuleManager
- SharedEventManager
- EventManager & Zend\EventManager\EventManagerInterface
All other services are configured after module loading, thus can be
overridden by modules.
public static init ( array $configuration = [] ) : Application |
$configuration |
array |
|
Результат |
Application |
|
public run ( ) : self |
Результат |
self |
|
setEventManager()
публичный Метод
Set the event manager instance
public setEventManager ( Zend\EventManager\EventManagerInterface $eventManager ) : Application |
$eventManager |
Zend\EventManager\EventManagerInterface |
|
Результат |
Application |
|
Описание свойств
$defaultListeners защищенное свойство
Default application event listeners
protected array $defaultListeners |
Результат |
array |
|
$event защищенное свойство
protected MvcEvent,Zend\Mvc $event |
Результат |
MvcEvent |
|
$events защищенное свойство
protected EventManagerInterface,Zend\EventManager $events |
Результат |
Zend\EventManager\EventManagerInterface |
|
$request защищенное свойство
protected RequestInterface,Zend\Stdlib $request |
Результат |
Zend\Stdlib\RequestInterface |
|
$response защищенное свойство
protected ResponseInterface,Zend\Stdlib $response |
Результат |
Zend\Stdlib\ResponseInterface |
|
$serviceManager защищенное свойство
protected ServiceManager,Zend\ServiceManager $serviceManager |
Результат |
Zend\ServiceManager\ServiceManager |
|