systream/router

1.3.0 2016-11-11 12:36 UTC

This package is not auto-updated.

Last update: 2024-10-26 20:53:29 UTC


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());

Test

Build Status