Download the PHP package racoon/router without Composer
On this page you can find all versions of the php package racoon/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download racoon/router
More information about racoon/router
Files in racoon/router
Package router
Short Description A basic extension of nikic/fast-route.
License proprietary
Informations about the package router
Racoon Router
Routing
Racoon uses nikic/fast-route to deal with routing.
Defining where routes are stored
Routes need to be added in a routes file, which should be added to the Router
, or defined in an anonymous function passed to the router.
If you want to store routes in multiple locations you can do it as follows.
If you define multiple route locations, they will be included/added in the same order as you define them.
To define routes without storing them in a separate file you can do the following.
Setting up routes
Inside one of the route files that have been added to the router you need to define your routes in the following format.
Route Groups
To make it easier to set up long urls multiple times you can use groups. The following code blocks give the same result.
You can also use sub-groups. The following code blocks give the same result.
HTTP Request Method
The HTTP Request Method(s) that the route should match. This can be any HTTP request type such as GET
or POST
.
Can be a string
or an array
of string
s.
Request URI
The request URI that the route should match.
You can define the request URI in multiple ways.
For more information see the FastRoute Route Docs
Any wildcards/placeholders defined here will be passed into the Controller/Handler method.
Handler String
The handler string defines the class and method that should be executed should the current request match a route.
The required format is \MyApp\Users@list
where \MyApp\Users
is the full class name including the namespace, and list
is the method inside of that class which you want to be executed.