Some improvements
This commit is contained in:
parent
2b76b40d82
commit
7f6d6eb9c6
10
README.md
10
README.md
|
@ -5,10 +5,10 @@ It utilizes RegExp and PHPs anonymous functions to create a lightweight and fast
|
|||
The router supports dynamic path parameters, special 404 and 405 routes as well as verification of request methods like get, post, put, delete etc...
|
||||
The codebase is very small and very easy to understand. So you can use it as boilerplate for a more complex router.
|
||||
|
||||
Take a look in the index.php file. As you can see the ```Route::add()``` method is used to add new routes to your project.
|
||||
The first argument takes the path segment. You can also use RegExp in there to parse out variables.
|
||||
The second argument will match the request method. The default method is 'get'.
|
||||
Take a look at the index.php file. As you can see the ```Route::add()``` method is used to add new routes to your project.
|
||||
The first argument takes the path segment. You can also use RegExp in there to parse out variables.
|
||||
All matching variables will be pushed to the handler method.
|
||||
The second argument will match the request method. The default method is 'get'.
|
||||
|
||||
## Simple example:
|
||||
```
|
||||
|
@ -25,8 +25,10 @@ You will find a more complex example with a build in navigation in the index.php
|
|||
|
||||
## Use a different basepath
|
||||
If your script lives in a subfolder e.g. /api/v1 set this basepath in your run method:
|
||||
|
||||
```Route::run('/api/v1');```
|
||||
Do not forget to edit the basepath in .htaccess if you are on apache
|
||||
|
||||
Do not forget to edit the basepath in .htaccess if you are on apache.
|
||||
|
||||
## Something does not work?
|
||||
* Dont forget to set the correct basepath as argument in your run method and in your .htaccess file.
|
||||
|
|
Loading…
Reference in New Issue
Block a user