Download the PHP package guyliangilsing/php-abstract-router without Composer
On this page you can find all versions of the php package guyliangilsing/php-abstract-router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download guyliangilsing/php-abstract-router
More information about guyliangilsing/php-abstract-router
Files in guyliangilsing/php-abstract-router
Package php-abstract-router
Short Description A simple package that provides you with a framework agnostic router.
License MIT
Informations about the package php-abstract-router
PHPAbstractRouter
A simple package that provides you with a framework agnostic router.
Table of contents
- PHPAbstractRouter
- Table of contents
- What is this exactly?
- Installation
- Usage
- Defining routes manually
- Defining routes through attributes
- Defining group routes
- Integrating a routing backend
What is this exactly?
PHPAbstractRouter is a framework agnostic router that lets you define routes manually, or through attributes. It is up to the person using this package to provide the router with an actual routing backend. A backend could be a framework (like slim 4), or an actual router (like FastRoute).
Installation
Usage
Defining routes manually
You can manually define routes through the Router
class:
Defining routes through attributes
You can define your routes inside classes through attributes:
Once you have defined your routes, you then can let the RouterFacade
collect them:
Defining group routes
Group routes can be defined through the GroupRouter
class:
Integrating a routing backend
To integrate your preferred routing backend, you only have to implement the BackendRouteRegistererInterface
interface:
Once you have implemented this interface, you can pass it to the Router
class through its constructor.