PHP code example of raxos / router

1. Go to this page and download the library: Download raxos/router 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/ */

    

raxos / router example snippets



declare(strict_types=1);

use Raxos\Container\Container;
use Raxos\Http\HttpMethod;
use Raxos\Http\HttpRequest;
use Raxos\Http\Response\JsonHttpResponse;
use Raxos\Router\Attribute\Controller;
use Raxos\Router\Attribute\Get;
use Raxos\Router\Router;

iner(), [ProductController::class]);
$request = HttpRequest::create(method: HttpMethod::GET, uri: '/products/42');

$router->resolve($request)->send();