PHP code example of pawel-jakowczyk / routing

1. Go to this page and download the library: Download pawel-jakowczyk/routing library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pawel-jakowczyk / routing example snippets


use Laminas\Diactoros\ServerRequest;
use PJ\Routing\RoutingMiddleware;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Symfony\Component\Routing\RouteCollection;

$middleware = RoutingMiddleware::create(new RouteCollection());
$middleware->process(
    new ServerRequest(),
    new class() implements RequestHandlerInterface
    {
        public function handle(ServerRequestInterface $request): ResponseInterface
        {
            return new Response();
        }
    }
);