sohoa/framework — pull request #79 by camael24 (2014-06-08 15:33:51+00:00)
Title: F/prefix alias resource

2 Features pour le router :
>Avoir la possibilité d'aliaser une resource exemple
>Pouvoir prefixer une resource

##### Alias

```
$router->resource('foo', ['as' => 'v' , 'only' => ['show']]);

array(1) {
[0]=>
array(4) {
[0]=>
string(5) "showV"
[1]=>
string(3) "get"
[2]=>
string(21) "/foo/(?[^/]+)"
[3]=>
string(8) "Foo#show"
}
}
```
On peut également avoir
```
$router->resource('bar', ['only' => ['show']]);
$router
->resource('foo', ['only' => ['show']])
->resource('bar', ['only' => ['show']]);

array(3) {
[0]=>
array(4) {
[0]=>
string(7) "showBar"
[1]=>
string(3) "get"
[2]=>
string(21) "/bar/(?[^/]+)"
[3]=>
string(8) "Bar#show"
}
[1]=>
array(4) {
[0]=>
string(7) "showFoo"
[1]=>
string(3) "get"
[2]=>
string(21) "/foo/(?[^/]+)"
[3]=>
string(8) "Foo#show"
}
[2]=>
array(4) {
[0]=>
string(10) "showFooBar"
[1]=>
string(3) "get"
[2]=>
string(42) "/foo/(?[^/]+)/bar/(?[^/]+)"
[3]=>
string(8) "Bar#show"
}
}
```
##### Prefix

On peut préfixer des routes par exemple pour une inferface d'administration comme :
```
$router
->resource('bar', ['only' => ['show'] , 'prefix' => '/admin'])
->resource('foo', ['only' => ['show']]);

array(2) {
[0]=>
array(4) {
[0]=>
string(7) "showBar"
[1]=>
string(3) "get"
[2]=>
string(27) "/admin/bar/(?[^/]+)"
[3]=>
string(8) "Bar#show"
}
[1]=>
array(4) {
[0]=>
string(10) "showBarFoo"
[1]=>
string(3) "get"
[2]=>
string(48) "/admin/bar/(?[^/]+)/foo/(?[^/]+)"
[3]=>
string(8) "Foo#show"
}
}
```