systream / router
1.3.0
2016-11-11 12:36 UTC
Requires
- php: >=5.4.0 || >= 7.0
- zendframework/zend-diactoros: 1.3.6
Requires (Dev)
- phpunit/phpunit: ^5.5
README
Installation
You can install this package via packagist.org with composer.
composer require systream/router
composer.json:
"require": { "systream/router": "1.*" }
This library requires php 5.6
or higher, but also works on php 5.4.
Usage
Setup routing
$route = new Router(); $route->addRoute(new SimpleRouting('/foo', new TestController())); $route->addRoute(new SimpleRouting('/foo/{id}', new TestController2())); $route->addRoute(new PathBasedRouting('app/Controller/Api', '\MyAppNamespace\Controller\Api')); $route->addRoute(new FinalMatchRouting(new NotFoundController())); $serverRequest = ServerRequestFactory::fromGlobals(); $route->dispatch($serverRequest, new SapiEmitter());