@@ -5,27 +5,27 @@ focusing on performance and flexibility.
5
5
6
6
The MVC layer is built on top of the following components:
7
7
8
- - ` Zend\ServiceManager ` - Zend Framework provides a set of default service definitions set up at
8
+ * ` Zend\ServiceManager ` - Zend Framework provides a set of default service definitions set up at
9
9
` Zend\Mvc\Service ` . The ` ServiceManager ` creates and configures your application instance and
10
10
workflow.
11
- - ` Zend\EventManager ` - The MVC is event driven. This component is used everywhere from initial
11
+ * ` Zend\EventManager ` - The MVC is event driven. This component is used everywhere from initial
12
12
bootstrapping of the application, through returning response and request calls, to setting and
13
13
retrieving routes and matched routes, as well as render views.
14
- - ` Zend\Http ` - specifically the request and response objects, used within:
15
- - ` Zend\Stdlib\DispatchableInterface ` . All "controllers" are simply dispatchable objects.
14
+ * ` Zend\Http ` - specifically the request and response objects, used within:
15
+ * ` Zend\Stdlib\DispatchableInterface ` . All "controllers" are simply dispatchable objects.
16
16
17
17
Within the MVC layer, several sub-components are exposed:
18
18
19
- - ` Zend\Mvc\Router ` contains classes pertaining to routing a request. In other words, it matches the
19
+ * ` Zend\Mvc\Router ` contains classes pertaining to routing a request. In other words, it matches the
20
20
request to its respective controller (or dispatchable).
21
- - ` Zend\Http\PhpEnvironment ` provides a set of decorators for the HTTP ` Request ` and ` Response `
21
+ * ` Zend\Http\PhpEnvironment ` provides a set of decorators for the HTTP ` Request ` and ` Response `
22
22
objects that ensure the request is injected with the current environment (including query
23
23
parameters, POST parameters, HTTP headers, etc.)
24
- - ` Zend\Mvc\Controller ` , a set of abstract "controller" classes with basic responsibilities such as
24
+ * ` Zend\Mvc\Controller ` , a set of abstract "controller" classes with basic responsibilities such as
25
25
event wiring, action dispatching, etc.
26
- - ` Zend\Mvc\Service ` provides a set of ` ServiceManager ` factories and definitions for the default
26
+ * ` Zend\Mvc\Service ` provides a set of ` ServiceManager ` factories and definitions for the default
27
27
application workflow.
28
- - ` Zend\Mvc\View ` provides default wiring for renderer selection, view script resolution, helper
28
+ * ` Zend\Mvc\View ` provides default wiring for renderer selection, view script resolution, helper
29
29
registration, and more; additionally, it provides a number of listeners that tie into the MVC
30
30
workflow, providing features such as automated template name resolution, automated view model
31
31
creation and injection, and more.
@@ -162,15 +162,15 @@ The `view` directory contains view scripts related to your controllers.
162
162
163
163
The ` Application ` has six basic dependencies.
164
164
165
- - ** configuration** , usually an array or object implementing ` Traversable ` .
166
- - ** ServiceManager** instance.
167
- - ** EventManager** instance, which, by default, is pulled from the ` ServiceManager ` , by the service
165
+ * ** configuration** , usually an array or object implementing ` Traversable ` .
166
+ * ** ServiceManager** instance.
167
+ * ** EventManager** instance, which, by default, is pulled from the ` ServiceManager ` , by the service
168
168
name "EventManager".
169
- - ** ModuleManager** instance, which, by default, is pulled from the ` ServiceManager ` , by the service
169
+ * ** ModuleManager** instance, which, by default, is pulled from the ` ServiceManager ` , by the service
170
170
name "ModuleManager".
171
- - ** Request** instance, which, by default, is pulled from the ` ServiceManager ` , by the service name
171
+ * ** Request** instance, which, by default, is pulled from the ` ServiceManager ` , by the service name
172
172
"Request".
173
- - ** Response** instance, which, by default, is pulled from the ` ServiceManager ` , by the service name
173
+ * ** Response** instance, which, by default, is pulled from the ` ServiceManager ` , by the service name
174
174
"Response".
175
175
176
176
These may be satisfied at instantiation:
@@ -196,13 +196,13 @@ $application = new Application($config, $serviceManager);
196
196
Once you've done this, there are two additional actions you can take. The first is to "bootstrap"
197
197
the application. In the default implementation, this does the following:
198
198
199
- - Attaches the default route listener (` Zend\Mvc\RouteListener ` ).
200
- - Attaches the default dispatch listener (` Zend\Mvc\DispatchListener ` ).
201
- - Attaches the ` ViewManager ` listener (` Zend\Mvc\View\ViewManager ` ).
202
- - Creates the ` MvcEvent ` , and injects it with the application, request, and response; it also
199
+ * Attaches the default route listener (` Zend\Mvc\RouteListener ` ).
200
+ * Attaches the default dispatch listener (` Zend\Mvc\DispatchListener ` ).
201
+ * Attaches the ` ViewManager ` listener (` Zend\Mvc\View\ViewManager ` ).
202
+ * Creates the ` MvcEvent ` , and injects it with the application, request, and response; it also
203
203
retrieves the router (` Zend\Mvc\Router\Http\TreeRouteStack ` ) at this time and attaches it to the
204
204
event.
205
- - Triggers the "bootstrap" event.
205
+ * Triggers the "bootstrap" event.
206
206
207
207
If you do not want these actions, or want to provide alternatives, you can do so by extending the
208
208
` Application ` class and/or simply coding what actions you want to occur.
@@ -260,22 +260,21 @@ $configuration = include 'config/application.config.php';
260
260
Application::init($configuration)->run();
261
261
```
262
262
263
- The ` init() ` method will basically do the following:
264
- - Grabs the application configuration and pulls from the ` service_manager ` key, creating a
265
- ` ServiceManager `
266
- instance with it and with the default services shipped with ` Zend\Mvc ` ;
263
+ The ` init() ` method will basically do the following:
267
264
268
- - Create a service named ` ApplicationConfig ` with the application configuration array;
269
- - Grabs the ` ModuleManager ` service and load the modules;
270
- - ` bootstrap() ` s the ` Application ` and returns its instance;
265
+ * Grabs the application configuration and pulls from the ` service_manager ` key, creating a
266
+ ` ServiceManager ` instance with it and with the default services shipped with ` Zend\Mvc ` ;
267
+ * Create a service named ` ApplicationConfig ` with the application configuration array;
268
+ * Grabs the ` ModuleManager ` service and load the modules;
269
+ * ` bootstrap() ` s the ` Application ` and returns its instance;
271
270
272
271
> ## Note
273
272
If you use the ` init() ` method, you cannot specify a service with the name of 'ApplicationConfig' in
274
273
your service manager config. This name is reserved to hold the array from application.config.php.
275
274
The following services can only be overridden from application.config.php:
276
- - ` ModuleManager `
277
- - ` SharedEventManager `
278
- - ` EventManager ` & ` Zend\EventManager\EventManagerInterface `
275
+ * ` ModuleManager `
276
+ * ` SharedEventManager `
277
+ * ` EventManager ` & ` Zend\EventManager\EventManagerInterface `
279
278
All other services are configured after module loading, thus can be overridden by modules.
280
279
281
280
You'll note that you have a great amount of control over the workflow. Using the ` ServiceManager ` ,
0 commit comments