Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit c0f13eb

Browse files
committed
Merge branch 'develop'
Merge develop to master for 0.2.0 release.
2 parents 7db54e0 + 9d06dc0 commit c0f13eb

20 files changed

+108
-67
lines changed

CHANGELOG.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,34 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5-
## 0.1.1 - 2015-09-03
5+
## 0.2.0 - TBD
66

7-
Initial tagged release.
7+
### Added
8+
9+
- [#116](https://github.com/zendframework/zend-expressive/pull/116) adds
10+
`Application::any()` to complement the various HTTP-specific routing methods;
11+
it has the same signature as `get()`, `post()`, `patch()`, et al, but allows
12+
any HTTP method.
13+
- [#120](https://github.com/zendframework/zend-expressive/pull/120) renames the
14+
router classes for easier discoverability, to better reflect their usage, and
15+
for better naming consistency. `Aura` becomes `AuraRouter`, `FastRoute`
16+
becomes `FastRouteRouter` and `Zf2` becomes `Zf2Router`.
17+
18+
### Deprecated
19+
20+
- Nothing.
21+
22+
### Removed
23+
24+
- [#120](https://github.com/zendframework/zend-expressive/pull/120) removes the
25+
classes `Zend\Expressive\Router\Aura`, `Zend\Expressive\Router\FastRoute`, and
26+
`Zend\Expressive\Router\Zf`, per the "Added" section above.
27+
28+
### Fixed
29+
30+
- Nothing.
31+
32+
## 0.1.1 - 2015-09-03
833

934
### Added
1035

doc/book/application.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ where:
116116
This method is typically only used if you want a single middleware to handle
117117
multiple HTTP request methods.
118118

119-
### get(), post(), put(), patch(), delete()
119+
### get(), post(), put(), patch(), delete(), any()
120120

121-
Each of the methods `get()`, `post()`, `put()`, `patch()`, and `delete()`
121+
Each of the methods `get()`, `post()`, `put()`, `patch()`, `delete()`, and `any()`
122122
proxies to `route()` and has the signature:
123123

124124
```php

doc/book/router/aura.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,27 @@ $ composer require aura/router
4646

4747
## Quick Start
4848

49-
At its simplest, you can instantiate a `Zend\Expressive\Router\Aura` instance
49+
At its simplest, you can instantiate a `Zend\Expressive\Router\AuraRouter` instance
5050
with no arguments; it will create the underlying Aura.Router objects required
5151
and compose them for you:
5252

5353
```php
54-
use Zend\Expressive\Router\Aura;
54+
use Zend\Expressive\Router\AuraRouter;
5555

56-
$router = new Aura();
56+
$router = new AuraRouter();
5757
```
5858

5959
## Programmatic Creation
6060

6161
If you need greater control over the Aura.Router setup and configuration, you
6262
can create the instances necessary and inject them into
63-
`Zend\Expressive\Router\Aura` during instantiation.
63+
`Zend\Expressive\Router\AuraRouter` during instantiation.
6464

6565
```php
6666
<?php
6767
use Aura\Router\RouterFactory;
6868
use Zend\Expressive\AppFactory;
69-
use Zend\Expressive\Router\Aura as AuraBridge;
69+
use Zend\Expressive\Router\AuraRouter as AuraBridge;
7070

7171
$auraRouter = (new RouterFactory())->newInstance();
7272
$auraRouter->setSecure(true);
@@ -98,7 +98,7 @@ two strategies for creating your Aura.Router implementation.
9898
### Basic Router
9999

100100
If you don't need to provide any setup or configuration, you can simply
101-
instantiate and return an instance of `Zend\Expressive\Router\Aura` for the
101+
instantiate and return an instance of `Zend\Expressive\Router\AuraRouter` for the
102102
service name `Zend\Expressive\Router\RouterInterface`.
103103

104104
A factory would look like this:
@@ -108,17 +108,17 @@ A factory would look like this:
108108
namespace Application\Container;
109109

110110
use Interop\Container\ContainerInterface;
111-
use Zend\Expressive\Router\Aura;
111+
use Zend\Expressive\Router\AuraRouter;
112112

113113
class RouterFactory
114114
{
115115
/**
116116
* @param ContainerInterface $container
117-
* @return Aura
117+
* @return AuraRouter
118118
*/
119119
public function __invoke(ContainerInterface $container)
120120
{
121-
return new Aura();
121+
return new AuraRouter();
122122
}
123123
}
124124
```
@@ -144,7 +144,7 @@ class as an invokable:
144144
```php
145145
$container->setInvokableClass(
146146
'Zend\Expressive\Router\RouterInterface',
147-
'Zend\Expressive\Router\Aura'
147+
'Zend\Expressive\Router\AuraRouter'
148148
);
149149
```
150150

@@ -155,7 +155,7 @@ example, we will be defining two factories:
155155

156156
- A factory to register as and generate an `Aura\Router\Router` instance.
157157
- A factory registered as `Zend\Expressive\Router\RouterInterface`, which
158-
creates and returns a `Zend\Expressive\Router\Aura` instance composing the
158+
creates and returns a `Zend\Expressive\Router\AuraRouter` instance composing the
159159
`Aura\Router\Router` instance.
160160

161161
Sound difficult? It's not; we've essentially done it above already!
@@ -189,7 +189,7 @@ class AuraRouterFactory
189189
namespace Application\Container;
190190

191191
use Interop\Container\ContainerInterface;
192-
use Zend\Expressive\Router\Aura as AuraBridge;
192+
use Zend\Expressive\Router\AuraRouter as AuraBridge;
193193

194194
class RouterFactory
195195
{

doc/book/router/fast-route.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ dispatcher to match incoming requests against routes.
1010

1111
If you wish to use a different combination — e.g., to use the Group Position
1212
Based route matcher — you will need to create your own instances and inject them
13-
into the `Zend\Expressive\Router\FastRoute` class, at instantiation.
13+
into the `Zend\Expressive\Router\FastRouteRouter` class, at instantiation.
1414

15-
The `FastRoute` bridge class accepts two arguments at instantiation:
15+
The `FastRouteRouter` bridge class accepts two arguments at instantiation:
1616

1717
- A `FastRoute\RouteCollector` instance
1818
- A callable that will return a `FastRoute\Dispatcher\RegexBasedAbstract`
@@ -31,7 +31,7 @@ $ composer require nikic/fast-route
3131

3232
## Quick Start
3333

34-
At its simplest, you can instantiate a `Zend\Expressive\Router\FastRoute` instance
34+
At its simplest, you can instantiate a `Zend\Expressive\Router\FastRouteRouter` instance
3535
with no arguments; it will create the underlying FastRoute objects required
3636
and compose them for you:
3737

@@ -45,11 +45,11 @@ $router = new FastRoute();
4545

4646
If you need greater control over the FastRoute setup and configuration, you
4747
can create the instances necessary and inject them into
48-
`Zend\Expressive\Router\FastRoute` during instantiation.
48+
`Zend\Expressive\Router\FastRouteRouter` during instantiation.
4949

5050
To do so, you will need to setup your `RouteCollector` instance and/or
5151
optionally callable to return your `RegexBasedAbstract` instance manually,
52-
inject them in your `Zend\Expressive\Router\FastRoute` instance, and inject use
52+
inject them in your `Zend\Expressive\Router\FastRouteRouter` instance, and inject use
5353
that when creating your `Application` instance.
5454

5555
```php
@@ -60,7 +60,7 @@ use FastRoute\RouteCollector;
6060
use FastRoute\RouteGenerator;
6161
use FastRoute\RouteParser\Std as RouteParser;
6262
use Zend\Expressive\AppFactory;
63-
use Zend\Expressive\Router\FastRoute as FastRouteBridge;
63+
use Zend\Expressive\Router\FastRouteRouter as FastRouteBridge;
6464

6565
$fastRoute = new RouteCollector(
6666
new RouteParser(),
@@ -95,7 +95,7 @@ two strategies for creating your FastRoute implementation.
9595
### Basic Router
9696

9797
If you don't need to provide any setup or configuration, you can simply
98-
instantiate and return an instance of `Zend\Expressive\Router\FastRoute` for the
98+
instantiate and return an instance of `Zend\Expressive\Router\FastRouteRouter` for the
9999
service name `Zend\Expressive\Router\RouterInterface`.
100100

101101
A factory would look like this:
@@ -105,17 +105,17 @@ A factory would look like this:
105105
namespace Application\Container;
106106

107107
use Interop\Container\ContainerInterface;
108-
use Zend\Expressive\Router\FastRoute;
108+
use Zend\Expressive\Router\FastRouteRouter;
109109

110110
class RouterFactory
111111
{
112112
/**
113113
* @param ContainerInterface $container
114-
* @return FastRoute
114+
* @return FastRouteRouter
115115
*/
116116
public function __invoke(ContainerInterface $container)
117117
{
118-
return new FastRoute();
118+
return new FastRouteRouter();
119119
}
120120
}
121121
```
@@ -141,7 +141,7 @@ class as an invokable:
141141
```php
142142
$container->setInvokableClass(
143143
'Zend\Expressive\Router\RouterInterface',
144-
'Zend\Expressive\Router\FastRoute'
144+
'Zend\Expressive\Router\FastRouteRouter'
145145
);
146146
```
147147

@@ -154,7 +154,7 @@ example, we will be defining three factories:
154154
- A factory to register as `FastRoute\DispatcherFactory` and return a callable
155155
factory that returns a `RegexBasedAbstract` instance.
156156
- A factory registered as `Zend\Expressive\Router\RouterInterface`, which
157-
creates and returns a `Zend\Expressive\Router\FastRoute` instance composing the
157+
creates and returns a `Zend\Expressive\Router\FastRouteRouter` instance composing the
158158
two services.
159159

160160
Sound difficult? It's not; we've essentially done it above already!
@@ -208,7 +208,7 @@ class FastRouteDispatcherFactory
208208
namespace Application\Container;
209209

210210
use Interop\Container\ContainerInterface;
211-
use Zend\Expressive\Router\FastRoute as FastRouteBridge;
211+
use Zend\Expressive\Router\FastRouteRouter as FastRouteBridge;
212212

213213
class RouterFactory
214214
{

doc/book/router/zf2.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ implementation; for HTTP applications, the default used in ZF2 applications is
55
`Zend\Mvc\Router\Http\TreeRouteStack`, which can compose a number of different
66
routes of differing types in order to perform routing.
77

8-
The ZF2 bridge we provide, `Zend\Expressive\Router\Zf`, uses the
8+
The ZF2 bridge we provide, `Zend\Expressive\Router\Zf2Router`, uses the
99
`TreeRouteStack`, and injects `Segment` routes to it; these are in turn injected
1010
with `Method` routes, and a special "method not allowed" route at negative
1111
priority to enable us to distinguish between failure to match the path and
@@ -16,7 +16,7 @@ If you instantiate it with no arguments, it will create an empty
1616

1717
```php
1818
use Zend\Expressive\AppFactory;
19-
use Zend\Expressive\Router\Zf2 as Zf2Router;
19+
use Zend\Expressive\Router\Zf2Router;
2020

2121
$app = AppFactory(null, new Zf2Router());
2222
```
@@ -52,14 +52,14 @@ $ composer require zendframework/zend-mvc zendframework/zend-psr7bridge
5252

5353
## Quick Start
5454

55-
At its simplest, you can instantiate a `Zend\Expressive\Router\Zf2` instance
55+
At its simplest, you can instantiate a `Zend\Expressive\Router\Zf2Router` instance
5656
with no arguments; it will create the underlying zend-mvc routing objects
5757
required and compose them for you:
5858

5959
```php
60-
use Zend\Expressive\Router\Zf2;
60+
use Zend\Expressive\Router\Zf2Router;
6161

62-
$router = new Zf2();
62+
$router = new Zf2Router();
6363
```
6464

6565
## Programmatic Creation
@@ -70,7 +70,7 @@ you can create the instances necessary and inject them into
7070

7171
```php
7272
use Zend\Expressive\AppFactory;
73-
use Zend\Expressive\Router\Zf2 as Zf2Bridge;
73+
use Zend\Expressive\Router\Zf2Router as Zf2Bridge;
7474
use Zend\Mvc\Router\Http\TreeRouteStack;
7575

7676
$zf2Router = new TreeRouteStack();
@@ -101,7 +101,7 @@ two strategies for creating your zend-mvc router implementation.
101101
### Basic Router
102102

103103
If you don't need to provide any setup or configuration, you can simply
104-
instantiate and return an instance of `Zend\Expressive\Router\Zf2` for the
104+
instantiate and return an instance of `Zend\Expressive\Router\Zf2Router` for the
105105
service name `Zend\Expressive\Router\RouterInterface`.
106106

107107
A factory would look like this:
@@ -111,17 +111,17 @@ A factory would look like this:
111111
namespace Application\Container;
112112

113113
use Interop\Container\ContainerInterface;
114-
use Zend\Expressive\Router\Zf2;
114+
use Zend\Expressive\Router\Zf2Router;
115115

116116
class RouterFactory
117117
{
118118
/**
119119
* @param ContainerInterface $container
120-
* @return Zf2
120+
* @return Zf2Router
121121
*/
122122
public function __invoke(ContainerInterface $container)
123123
{
124-
return new Zf2();
124+
return new Zf2Router();
125125
}
126126
}
127127
```
@@ -147,7 +147,7 @@ class as an invokable:
147147
```php
148148
$container->setInvokableClass(
149149
'Zend\Expressive\Router\RouterInterface',
150-
'Zend\Expressive\Router\Zf2'
150+
'Zend\Expressive\Router\Zf2Router'
151151
);
152152
```
153153

@@ -159,7 +159,7 @@ example, we will be defining two factories:
159159
- A factory to register as and generate an `Zend\Mvc\Router\Http\TreeRouteStack`
160160
instance.
161161
- A factory registered as `Zend\Expressive\Router\RouterInterface`, which
162-
creates and returns a `Zend\Expressive\Router\Zf2` instance composing the
162+
creates and returns a `Zend\Expressive\Router\Zf2Router` instance composing the
163163
`Zend\Mvc\Router\Http\TreeRouteStack` instance.
164164

165165
Sound difficult? It's not; we've essentially done it above already!
@@ -191,7 +191,7 @@ class TreeRouteStackFactory
191191
namespace Application\Container;
192192

193193
use Interop\Container\ContainerInterface;
194-
use Zend\Expressive\Router\Zf2 as Zf2Bridge;
194+
use Zend\Expressive\Router\Zf2Router as Zf2Bridge;
195195

196196
class RouterFactory
197197
{

src/AppFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function create(
4848
Router\RouterInterface $router = null
4949
) {
5050
$container = $container ?: new ServiceManager();
51-
$router = $router ?: new Router\Aura();
51+
$router = $router ?: new Router\AuraRouter();
5252
$emitter = new Emitter\EmitterStack();
5353
$emitter->push(new SapiEmitter());
5454

src/Application.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,17 @@ public function __call($method, $args)
155155
return call_user_func_array([$this, 'route'], $args);
156156
}
157157

158+
/**
159+
* @param string|Router\Route $path
160+
* @param callable|string $middleware Middleware (or middleware service name) to associate with route.
161+
* @param null|string $name the name of the route
162+
* @return Router\Route
163+
*/
164+
public function any($path, $middleware, $name = null)
165+
{
166+
return $this->route($path, $middleware, null, $name);
167+
}
168+
158169
/**
159170
* Overload pipe() operation.
160171
*

src/Container/ApplicationFactory.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111

1212
use Interop\Container\ContainerInterface;
1313
use Zend\Diactoros\Response\EmitterInterface;
14-
use Zend\Diactoros\Response\SapiEmitter;
1514
use Zend\Expressive\Application;
16-
use Zend\Expressive\Emitter\EmitterStack;
1715
use Zend\Expressive\Exception;
18-
use Zend\Expressive\Router\Aura as AuraRouter;
16+
use Zend\Expressive\Router\AuraRouter;
1917
use Zend\Expressive\Router\Route;
2018
use Zend\Expressive\Router\RouterInterface;
2119

src/Router/Aura.php renamed to src/Router/AuraRouter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Router implementation bridging the Aura.Router.
2121
*/
22-
class Aura implements RouterInterface
22+
class AuraRouter implements RouterInterface
2323
{
2424
/**
2525
* Aura router

src/Router/FastRoute.php renamed to src/Router/FastRouteRouter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Router implementation bridging nikic/fast-route.
2121
*/
22-
class FastRoute implements RouterInterface
22+
class FastRouteRouter implements RouterInterface
2323
{
2424
/**
2525
* @var callable A factory callback that can return a dispatcher.

0 commit comments

Comments
 (0)