Skip to content

Commit 8064b5f

Browse files
committed
2 parents 5c81da7 + 8d4e765 commit 8064b5f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [WIP] Simple PHP router
1+
# Simple PHP router
22
Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.
33

44
**Please note: this project has just been added and is still a work in progress. Please use with caution until a stable release version is available :)**
@@ -57,6 +57,17 @@ SimpleRouter::group(['prefix' => 'v1', 'middleware' => '\MyWebsite\Middleware\So
5757
SimpleRouter::group(['prefix' => 'services'], function() {
5858

5959
SimpleRouter::get('/answers/{id}', 'ControllerAnswers@show');
60+
61+
// Resetful ressource
62+
SimpleRouter::ressource('/rest', 'ControllerRessource');
63+
64+
// Load the entire controller (where url matches method names - getIndex(), postIndex() etc)
65+
SimpleRouter::controller('/controller', 'ControllerDefault');
66+
67+
// Example of providing callback instead of Controller
68+
SimpleRouter::get('/something', function() {
69+
die('Callback example');
70+
});
6071

6172
});
6273
});
@@ -147,7 +158,7 @@ function url($controller, $parameters = null, $getParams = null) {
147158

148159
In ```routes.php``` we have added this route:
149160

150-
```Router::get('/item/{id}', 'myController@show');```
161+
```SimpleRouter::get('/item/{id}', 'myController@show');```
151162

152163
In the template we then call:
153164

0 commit comments

Comments
 (0)