fratily / router
v2.0.0
2022-03-23 15:02 UTC
Requires
- php: ^8.0
- fratily/path-parser: ^0.2.0
Requires (Dev)
- phpstan/phpstan: ^1.2
- phpstan/phpstan-phpunit: ^1.0.0
- phpstan/phpstan-strict-rules: ^1.1.0
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
README
Usage
use Fratily\Router\RouterBuilder; use Fratily\Router\Route; use Fratily\Router\RouteOption; $option = new RouteOption(); $routes = [ new Route('/', $option->strictCheckTrailing(false)), new Route('/foo/bar', $option->strictCheckTrailing(false)), new Route('/foo/:name'), $matchRoute = (new Route('/foo/:name/setting')), new Route('/foo/:name/profile'), new Route('/bar'), new Route('/baz'), ]; $router = (new RouterBuilder($routes))->build(); [ 'route' => $route, // $matchRoute 'params' => $params // ['name' => 'any'] ] = $router->match('/foo/any/setting');