rosem / route
The route management package
v0.0.1
2018-06-01 20:06 UTC
Requires
- php: ~7.2
- psrnext/route: ~0.2
Requires (Dev)
- kint-php/kint: ^2.2
- nikic/fast-route: ^1.3
- phpunit/phpunit: >=5.4.3
- squizlabs/php_codesniffer: ^2.3
- symfony/routing: ^4.1
This package is not auto-updated.
Last update: 2025-03-02 07:53:37 UTC
README
Structure
If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.
bin/
config/
src/
tests/
vendor/
Install
Via Composer
$ composer require rosem/route
Usage
$router = new Rosem\Route\Router(); $router->addRoute('GET', '/user/{id:\d+}', 'handle') ->addMiddleware('Auth', ['setType' => 'digest']) ->addMiddleware('CSRF'); $result = $router->dispatch('GET', '/user/123'); echo $result === [ // HTTP status code 0 => 200, // Handler 1 => 'handle', // Middleware list 2 => [ 0 => [ 0 => 'Auth', 1 => [ 'setName' => 'digest', ] ], 1 => [ 0 => 'CSRF', 1 => [] ], ], // Variables list 3 => [ 'id' => '123', ], ];
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email iroman.via@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.