@@ -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.
@@ -172,15 +172,15 @@ The `view` directory contains view scripts related to your controllers.
172
172
173
173
The ` Application ` has six basic dependencies.
174
174
175
- - ** configuration** , usually an array or object implementing ` Traversable ` .
176
- - ** ServiceManager** instance.
177
- - ** EventManager** instance, which, by default, is pulled from the ` ServiceManager ` , by the service
175
+ * ** configuration** , usually an array or object implementing ` Traversable ` .
176
+ * ** ServiceManager** instance.
177
+ * ** EventManager** instance, which, by default, is pulled from the ` ServiceManager ` , by the service
178
178
name "EventManager".
179
- - ** ModuleManager** instance, which, by default, is pulled from the ` ServiceManager ` , by the service
179
+ * ** ModuleManager** instance, which, by default, is pulled from the ` ServiceManager ` , by the service
180
180
name "ModuleManager".
181
- - ** Request** instance, which, by default, is pulled from the ` ServiceManager ` , by the service name
181
+ * ** Request** instance, which, by default, is pulled from the ` ServiceManager ` , by the service name
182
182
"Request".
183
- - ** Response** instance, which, by default, is pulled from the ` ServiceManager ` , by the service name
183
+ * ** Response** instance, which, by default, is pulled from the ` ServiceManager ` , by the service name
184
184
"Response".
185
185
186
186
These may be satisfied at instantiation:
@@ -206,13 +206,13 @@ $application = new Application($config, $serviceManager);
206
206
Once you've done this, there are two additional actions you can take. The first is to "bootstrap"
207
207
the application. In the default implementation, this does the following:
208
208
209
- - Attaches the default route listener (` Zend\Mvc\RouteListener ` ).
210
- - Attaches the default dispatch listener (` Zend\Mvc\DispatchListener ` ).
211
- - Attaches the ` ViewManager ` listener (` Zend\Mvc\View\ViewManager ` ).
212
- - Creates the ` MvcEvent ` , and injects it with the application, request, and response; it also
209
+ * Attaches the default route listener (` Zend\Mvc\RouteListener ` ).
210
+ * Attaches the default dispatch listener (` Zend\Mvc\DispatchListener ` ).
211
+ * Attaches the ` ViewManager ` listener (` Zend\Mvc\View\ViewManager ` ).
212
+ * Creates the ` MvcEvent ` , and injects it with the application, request, and response; it also
213
213
retrieves the router (` Zend\Mvc\Router\Http\TreeRouteStack ` ) at this time and attaches it to the
214
214
event.
215
- - Triggers the "bootstrap" event.
215
+ * Triggers the "bootstrap" event.
216
216
217
217
If you do not want these actions, or want to provide alternatives, you can do so by extending the
218
218
` Application ` class and/or simply coding what actions you want to occur.
@@ -270,22 +270,21 @@ $configuration = include 'config/application.config.php';
270
270
Application::init($configuration)->run();
271
271
```
272
272
273
- The ` init() ` method will basically do the following:
274
- - Grabs the application configuration and pulls from the ` service_manager ` key, creating a
275
- ` ServiceManager `
276
- instance with it and with the default services shipped with ` Zend\Mvc ` ;
273
+ The ` init() ` method will basically do the following:
277
274
278
- - Create a service named ` ApplicationConfig ` with the application configuration array;
279
- - Grabs the ` ModuleManager ` service and load the modules;
280
- - ` bootstrap() ` s the ` Application ` and returns its instance;
275
+ * Grabs the application configuration and pulls from the ` service_manager ` key, creating a
276
+ ` ServiceManager ` instance with it and with the default services shipped with ` Zend\Mvc ` ;
277
+ * Create a service named ` ApplicationConfig ` with the application configuration array;
278
+ * Grabs the ` ModuleManager ` service and load the modules;
279
+ * ` bootstrap() ` s the ` Application ` and returns its instance;
281
280
282
281
> ### Note
283
282
If you use the ` init() ` method, you cannot specify a service with the name of 'ApplicationConfig' in
284
283
your service manager config. This name is reserved to hold the array from application.config.php.
285
284
The following services can only be overridden from application.config.php:
286
- - ` ModuleManager `
287
- - ` SharedEventManager `
288
- - ` EventManager ` & ` Zend\EventManager\EventManagerInterface `
285
+ * ` ModuleManager `
286
+ * ` SharedEventManager `
287
+ * ` EventManager ` & ` Zend\EventManager\EventManagerInterface `
289
288
All other services are configured after module loading, thus can be overridden by modules.
290
289
291
290
You'll note that you have a great amount of control over the workflow. Using the ` ServiceManager ` ,
0 commit comments