API

Overview of the bitframe-fastroute package including classes and their methods and properties

View Source

namespace BitFrame\Router;

use \Psr\Http\Message\ServerRequestInterface;
use \Psr\Http\Message\ResponseInterface;
use \Psr\Http\Server\RequestHandlerInterface;
use \FastRoute\Dispatcher;
use \FastRoute\RouteCollector;
use \BitFrame\Application;
use \BitFrame\Router\Route;
use \BitFrame\Router\RouteCollection;

// implements:
use \BitFrame\Router\RouterInterface;

// uses:
use \BitFrame\Router\RouterTrait;
use \BitFrame\Delegate\CallableMiddlewareTrait;
use \BitFrame\Dispatcher\DispatcherAwareTrait;

// exceptions:
use \FastRoute\BadRouteException;

/**
 * FastRoute wrapper class to manage http routes
 * as a middleware.
 */
class FastRouteRouter implements RouterInterface
{
    use RouterTrait;
    use CallableMiddlewareTrait;
    use DispatcherAwareTrait;
    
    /** @var \FastRoute\RouteCollector */
    private $routeCollector;

    
    public function __construct();
    
    /**
     * Process an incoming server request and return a
     * response, optionally delegating response creation
     * to a handler.
     *
     * @param ServerRequestInterface $request
     * @param RequestHandlerInterface $handler
     *
     * @return ResponseInterface
     *
     * @throws BadRouteException
     */
    public function process(  ): ResponseInterface;
    
    /**
     * Get Router class.
     *
     * @return RouteCollector
     */
    public function getRouter(): RouteCollector;
}

Comments

Let us know if you have something to say or add