ARouter  0.1.0
Annotation based router for your projects
Router Class Reference
Inheritance diagram for Router:
RouterInterface

Public Member Functions

 __construct (RouteMappingsScannerInterface $scanner, MethodArgumentsResolverService $argumentsResolverService, HttpMessageConverterManager $converterManager)
 
 getResponse (ServerRequestInterface $request)
 

Protected Member Functions

 getControllerInstance (string $controllerName)
 

Protected Attributes

 $routeMappings = NULL
 

Detailed Description

Main class for interaction with routing system.

This router is PSR-7 compatible, this means that it works with ServerRequestInterface.

Here is a basic example of using the Router class.

// Create router and pick up routes from 'src/Controller' directory.
$router = RouterFactory::getRouter('src/Controller');
// Get response for given request.
$response = $router->getResponse($request);

Constructor & Destructor Documentation

◆ __construct()

__construct ( RouteMappingsScannerInterface  $scanner,
MethodArgumentsResolverService  $argumentsResolverService,
HttpMessageConverterManager  $converterManager 
)

Router constructor.

Parameters
\ARouter\Routing\Scanner\RouteMappingsScannerInterface$scanner
\ARouter\Routing\Resolver\Service\MethodArgumentsResolverService$argumentsResolverService
\ARouter\Routing\HttpMessageConverter\HttpMessageConverterManager$converterManager

Member Function Documentation

◆ getControllerInstance()

getControllerInstance ( string  $controllerName)
protected

Get controller instance.

Parameters
string$controllerNameFull class name of controller class.
Returns
object Controller instance.

◆ getResponse()

getResponse ( ServerRequestInterface  $request)

{Get HTTP response object for given request.

Parameters
\Psr\Http\Message\ServerRequestInterface$requestHTTP request.
Returns
HTTP response object for given request.
}

Exceptions

Implements RouterInterface.


The documentation for this class was generated from the following file: