zegnat / simplisticrouter
The simplest of routers, just what I needed.
dev-develop
2017-12-16 14:57 UTC
Requires
- http-interop/http-server-handler: ^1.0
- psr/container: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
This package is not auto-updated.
Last update: 2024-11-15 03:40:18 UTC
README
The simplest of routers, just what I needed. When everything else seems to offer more functions than I need for a minimum viable product.
For anything more than an MVP, I am a really big fan of FastRoute and projects like Route that make use of it.
Install
Via Composer
$ composer require zegnat/simplistic-router
Usage
$handlers = new \Yuloh\Container\Container(); $handlers->set('index', function () { return new \App\SomeIndexControllerPerhaps(); }); $handlers->set('404', function () { return new \App\My404Handler(); }); $routes = [ [ 'route' => '/', 'handler' => 'index', ], ]; $router = new \Zegnat\SimplisticRouter\SimplisticRouter($routes, '404', $handlers); $response = $router->handle($request);
License
The BSD Zero Clause License (0BSD). Please see the LICENSE file for more information.