Download the PHP package echo-fusion/routemanager without Composer
On this page you can find all versions of the php package echo-fusion/routemanager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download echo-fusion/routemanager
More information about echo-fusion/routemanager
Files in echo-fusion/routemanager
Package routemanager
Short Description A lightweight and flexible routing package that helps manage HTTP routes in PHP applications. Supports PSR-7 and PSR-15, designed for MVC architecture with middleware integration.
License MIT
Informations about the package routemanager
Route manager
A lightweight and flexible routing package that helps manage HTTP routes in PHP applications. It supports PSR-7 and PSR-15 standards and is designed for MVC architecture with middleware integration.
Install
Via Composer
Requirements
The following versions of PHP are supported by this version.
- PHP 8.1
- PHP 8.2
- PHP 8.3
Usages
Basic Setup
-
To get started, you can use the RouteMatcher and Router classes directly.
- Defining Routes Define routes with optional regex constraints on route parameters. The action parameter can be:
- An array (e.g., [Controller::class, 'method'])
- A closure
- Dispatching and Executing a Route Once routes are defined, dispatch the request and execute the action if a match is found.
Using Provider
The RouteManagerProvider allows you to integrate Router and RouteMatch instances into a dependency injection container.
-
Register the Provider: Add RouteManagerProvider to your service container.
-
Define Routes Using Configuration: Configure routes by calling the boot method, passing an array of routes or a configuration file.
If no routes are provided, the boot method defaults to loading routes from routemanager.config.php.
- Dispatching a Route: With the routes registered, retrieve the RouterInterface from the container and dispatch it with a request object.
Testing
Testing includes PHPUnit and PHPStan (Level 7).
Credits
Developed and maintained by Amir Shadanfar.
Connect on LinkedIn.
License
The MIT License (MIT). Please see License File for more information.
All versions of routemanager with dependencies
psr/http-message Version ^2.0@dev
echo-fusion/contracts Version ^1.0