There are two ways to bootstrap your ZF2 app. The default is less flexible but handles the entire configuration, and the manual is really flexible but you have to take care of everything.
The goal of the bootstrap is to provide to the application, Zend\Mvc\Application
, with all the components and dependencies needed to successfully handle a request. A Zend Framework 2 application relies on the following six components:
Configuration array
ServiceManager instance
EventManager instance
ModuleManager instance
Request object
Response object
As these are the pillars of a ZF2 application, we will take a look at how these components are configured to bootstrap the app.
To begin with, we will see how the components interact from a high perspective and then we will jump into details of how each one works. When a new request arrives to our application, ZF2 needs to set up the environment to be able to fulfill it. This process implies reading configuration files and creating the required...