12
12
The base unit of routing is a ` Route ` :
13
13
14
14
``` php
15
- namespace Zend\Mvc\ Router;
15
+ namespace Zend\Router;
16
16
17
17
use Zend\Stdlib\RequestInterface as Request;
18
18
@@ -28,7 +28,7 @@ A `Route` accepts a `Request`, and determines if it matches. If so, it returns a
28
28
` RouteMatch ` object:
29
29
30
30
``` php
31
- namespace Zend\Mvc\ Router;
31
+ namespace Zend\Router;
32
32
33
33
class RouteMatch
34
34
{
@@ -58,7 +58,7 @@ facilitate this, you will use a route aggregate, usually implementing
58
58
` RouteStack ` :
59
59
60
60
``` php
61
- namespace Zend\Mvc\ Router;
61
+ namespace Zend\Router;
62
62
63
63
interface RouteStackInterface extends RouteInterface
64
64
{
@@ -125,15 +125,15 @@ adding it to the route stack.
125
125
126
126
### TreeRouteStack
127
127
128
- ` Zend\Mvc\ Router\Http\TreeRouteStack ` provides the ability to register trees of
128
+ ` Zend\Router\Http\TreeRouteStack ` provides the ability to register trees of
129
129
routes, and uses a B-tree algorithm to match routes. As such, you register a
130
130
single route with many children.
131
131
132
132
A ` TreeRouteStack ` will consist of the following configuration:
133
133
134
134
- A base "route", which describes the base match needed, the root of the tree.
135
135
- An optional ` route_plugins ` , which is a configured
136
- ` Zend\Mvc\ Router\RoutePluginManager ` that can lazy-load routes.
136
+ ` Zend\Router\RoutePluginManager ` that can lazy-load routes.
137
137
- The option ` may_terminate ` , which hints to the router that no other segments
138
138
will follow it.
139
139
- An optional ` child_routes ` array, which contains additional routes that stem
@@ -153,7 +153,7 @@ route.
153
153
154
154
zend-mvc ships with the following HTTP route types.
155
155
156
- ### Zend\\ Mvc \\ Router\\ Http\\ Hostname
156
+ ### Zend\\ Router\\ Http\\ Hostname
157
157
158
158
The ` Hostname ` route attempts to match the hostname registered in the request
159
159
against specific criteria. Typically, this will be in one of the following
@@ -198,7 +198,7 @@ $route = Hostname::factory([
198
198
When matched, the above will return two keys in the ` RouteMatch ` , "subdomain"
199
199
and "type".
200
200
201
- ### Zend\\ Mvc \\ Router\\ Http\\ Literal
201
+ ### Zend\\ Router\\ Http\\ Literal
202
202
203
203
The ` Literal ` route is for doing exact matching of the URI path. Configuration
204
204
therefore is solely the path you want to match, and the "defaults", or
@@ -217,7 +217,7 @@ $route = Literal::factory([
217
217
The above route would match a path "/foo", and return the key "action" in the
218
218
` RouteMatch ` , with the value "foo".
219
219
220
- ### Zend\\ Mvc \\ Router\\ Http\\ Method
220
+ ### Zend\\ Router\\ Http\\ Method
221
221
222
222
The ` Method ` route is used to match the HTTP method or 'verb' specified in the
223
223
request (See RFC 2616 Sec. 5.1.1). It can optionally be configured to match
@@ -236,7 +236,7 @@ $route = Method::factory([
236
236
The above route would match an http "POST" or "PUT" request and return a
237
237
` RouteMatch ` object containing a key "action" with a value of "form-submit".
238
238
239
- ### Zend\\ Mvc \\ Router\\ Http\\ Part
239
+ ### Zend\\ Router\\ Http\\ Part
240
240
241
241
A ` Part ` route allows crafting a tree of possible routes based on segments of
242
242
the URI path. It actually extends the ` TreeRouteStack ` .
@@ -328,32 +328,32 @@ You may use any route type as a child route of a `Part` route.
328
328
> ### Route plugins
329
329
>
330
330
> In the above example, the ` $routePlugins ` is an instance of
331
- > ` Zend\Mvc\ Router\RoutePluginManager ` , containing essentially the following
331
+ > ` Zend\Router\RoutePluginManager ` , containing essentially the following
332
332
> configuration:
333
333
>
334
334
> ``` php
335
- > $routePlugins = new Zend\Mvc\ Router\RoutePluginManager();
335
+ > $routePlugins = new Zend\Router\RoutePluginManager();
336
336
> $plugins = [
337
- > 'hostname' => 'Zend\Mvc\ Router\Http\Hostname',
338
- > 'literal' => 'Zend\Mvc\ Router\Http\Literal',
339
- > 'part' => 'Zend\Mvc\ Router\Http\Part',
340
- > 'regex' => 'Zend\Mvc\ Router\Http\Regex',
341
- > 'scheme' => 'Zend\Mvc\ Router\Http\Scheme',
342
- > 'segment' => 'Zend\Mvc\ Router\Http\Segment',
343
- > 'wildcard' => 'Zend\Mvc\ Router\Http\Wildcard',
344
- > 'query' => 'Zend\Mvc\ Router\Http\Query',
345
- > 'method' => 'Zend\Mvc\ Router\Http\Method',
337
+ > 'hostname' => 'Zend\Router\Http\Hostname',
338
+ > 'literal' => 'Zend\Router\Http\Literal',
339
+ > 'part' => 'Zend\Router\Http\Part',
340
+ > 'regex' => 'Zend\Router\Http\Regex',
341
+ > 'scheme' => 'Zend\Router\Http\Scheme',
342
+ > 'segment' => 'Zend\Router\Http\Segment',
343
+ > 'wildcard' => 'Zend\Router\Http\Wildcard',
344
+ > 'query' => 'Zend\Router\Http\Query',
345
+ > 'method' => 'Zend\Router\Http\Method',
346
346
> ];
347
347
> foreach ($plugins as $name => $class) {
348
348
> $routePlugins->setInvokableClass($name, $class);
349
349
> }
350
350
> ```
351
351
>
352
- > When using `Zend\Mvc\ Router\Http\TreeRouteStack`, the `RoutePluginManager` is
352
+ > When using `Zend\Router\Http\TreeRouteStack`, the `RoutePluginManager` is
353
353
> set up by default, and the developer does not need to worry about autoloading
354
354
> of standard HTTP routes.
355
355
356
- ### Zend\\Mvc\\ Router\\Http\\Regex
356
+ ### Zend\\Router\\Http\\Regex
357
357
358
358
A `Regex` route utilizes a regular expression to match against the URI path. Any
359
359
valid regular expression is allowed; our recommendation is to use named captures
@@ -385,7 +385,7 @@ items in the `RouteMatch`, an "id", the "controller", the "action", and the
385
385
"format". When assembling a URL from this route, the "id" and "format" values
386
386
would be used to fill the specification.
387
387
388
- ### Zend\\ Mvc \\ Router\\ Http\\ Scheme
388
+ ### Zend\\ Router\\ Http\\ Scheme
389
389
390
390
The ` Scheme ` route matches the URI scheme only, and must be an exact match. As
391
391
such, this route, like the ` Literal ` route, simply takes what you want to match
@@ -403,7 +403,7 @@ $route = Scheme::factory([
403
403
The above route would match the "https" scheme, and return the key "https" in
404
404
the ` RouteMatch ` with a boolean ` true ` value.
405
405
406
- ### Zend\\ Mvc \\ Router\\ Http\\ Segment
406
+ ### Zend\\ Router\\ Http\\ Segment
407
407
408
408
A ` Segment ` route allows matching any segment of a URI path. Segments are
409
409
denoted using a colon, followed by alphanumeric characters; if a segment is
@@ -440,7 +440,7 @@ $route = Segment::factory([
440
440
]);
441
441
```
442
442
443
- ### Zend\\ Mvc \\ Router\\ Http\\ Query (Deprecated)
443
+ ### Zend\\ Router\\ Http\\ Query (Deprecated)
444
444
445
445
> #### Potential security issue
446
446
>
@@ -449,7 +449,7 @@ $route = Segment::factory([
449
449
> #### Deprecated
450
450
>
451
451
> This route part is deprecated since you can now add query parameters without a
452
- > query route.
452
+ > query route. It was removed in version 3 of the router.
453
453
454
454
The ` Query ` route part allows you to specify and capture query string parameters
455
455
for a given route.
@@ -507,7 +507,7 @@ will then be appended as a query string.
507
507
The output from our example should then be
508
508
` /page/my-test-page?format=rss&limit=10 `
509
509
510
- ### Zend\\ Mvc \\ Router\\ Http\\ Wildcard (Deprecated)
510
+ ### Zend\\ Router\\ Http\\ Wildcard (Deprecated)
511
511
512
512
> #### Potential security issue
513
513
>
@@ -632,7 +632,7 @@ return [
632
632
'router' => [
633
633
'routes' => [
634
634
'modules.zendframework.com' => [
635
- 'type' => 'Zend\Mvc\ Router\Http\Hostname',
635
+ 'type' => 'Zend\Router\Http\Hostname',
636
636
'options' => [
637
637
'route' => ':4th.[:3rd.]:2nd.:1st', // domain levels from right to left
638
638
'constraints' => [
@@ -647,7 +647,7 @@ return [
647
647
// child route controllers may span multiple modules as desired
648
648
'child_routes' => [
649
649
'index' => [
650
- 'type' => 'Zend\Mvc\ Router\Http\Literal',
650
+ 'type' => 'Zend\Router\Http\Literal',
651
651
'options' => [
652
652
'route' => '/',
653
653
'defaults' => [
@@ -660,7 +660,7 @@ return [
660
660
],
661
661
],
662
662
'packages.zendframework.com' => [
663
- 'type' => 'Zend\Mvc\ Router\Http\Hostname',
663
+ 'type' => 'Zend\Router\Http\Hostname',
664
664
'options' => [
665
665
'route' => ':4th.[:3rd.]:2nd.:1st', // domain levels from right to left
666
666
'constraints' => [
@@ -675,7 +675,7 @@ return [
675
675
// child route controllers may span multiple modules as desired
676
676
'child_routes' => [
677
677
'index' => [
678
- 'type' => 'Zend\Mvc\ Router\Http\Literal',
678
+ 'type' => 'Zend\Router\Http\Literal',
679
679
'options' => [
680
680
'route' => '/',
681
681
'defaults' => [
0 commit comments