2017 © Pedro Peláez
 

library arouter

Annotation based router

image

undertext/arouter

Annotation based router

  • Friday, July 13, 2018
  • by undertext
  • Repository
  • 1 Watchers
  • 0 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 325 % Grown

The README.md

ARouter

Php annotation based router. Documentation can be found here, (*1)

Requirements

PHP version >= 7.1, (*2)

Installation

To install ARouter, run the command below:, (*3)

composer require undertext/arouter, (*4)

Quick example

// 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.

Main documentation sections:

NOTE: Due to Doxygen parser all code examples with PHP annotations do not wrap those annotations in DocBlock comment, (*5)

Build Status codecov, (*6)

The Versions

13/07 2018

dev-master

9999999-dev https://github.com/undertext/arouter

Annotation based router

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 router