air-php / routing
A routing library.
Installs: 3 109
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >=5.5.0
- air-php/http: ~0.1
- phpunit/phpunit: ~5.0
This package is not auto-updated.
Last update: 2024-12-31 03:42:25 UTC
README
The routing library includes classes for handling web application routing.
Installation
Installation via Composer is recommended.
"require": {
"air-php/routing": "dev-master"
}
Route
The Route
object represents an application route. It includes:
- A URI
- The type of request the route handles (e.g. GET, POST etc.)
- The target controller to instantiate
- The target controller action to call
Router
The Router
object is responsible for routing a request. It's configured with one or more Route
objects.
The route()
method takes a Request
object (compatible with Air's request interface) and returns a ResolvedRoute
. The method itself is abstract, allowing you to use routing logic of your choice.
ResolvedRequest
A ResolvedRequest
object represents a request which has been resolved by a Router
object.
It includes the original Request
and Route
objects, along with the URI parameters that were matched during routing.