dev-master
9999999-dev https://github.com/undertext/arouterAnnotation based router
MIT
The Requires
The Development Requires
psr-7 router
Annotation based router
Php annotation based router. Documentation can be found here, (*1)
PHP version >= 7.1, (*2)
To install ARouter, run the command below:, (*3)
composer require undertext/arouter
, (*4)
// Enable annotations autolading. This is a required step. AnnotationRegistry::registerLoader('class_exists'); // Build annotaion based router, find controllers in 'src/Controller' folder. $router = RouterFactory::getRouter('src/Controller'); // Get response based on request. try { $response = $router->getResponse(ServerRequest::fromGlobals()); } catch (RouteHandlerNotFoundException $e) { $response = new Response(404, [], "Route not found"); // This is an example of Guzzle HTTP Response usage. } outputResponse($response); // outputResponse is a function that converts response to string and outputs it.
NOTE: Due to Doxygen parser all code examples with PHP annotations do not wrap those annotations in DocBlock comment, (*5)
Annotation based router
MIT
psr-7 router