Route http requests to controller actions
composer require seeren/router
namespace App\Controller;
use Seeren\Controller\JsonController;
use Seeren\Router\Route\Route;
class FooController extends JsonController
{
#[Route("/path/(\d+)", "GET")]
public function show(int $id)
{
return $this->render([]);
}
}
Retrieve \Psr\Http\Message\ResponseInterface
from a routed controller
use Seeren\Router\Router;
$router = new Router();
$response = $router->getResponse();
Router use container configuration to inject arguments as primitve: https://github.com/seeren/container#interfaces
project/
└─ config/
└─ services.json
└─ routes.json
config/services.json
{
"parameters": {},
"services": {}
}
Controllers are resolved using anotation by default or configuration file. Captured matches are passed to controller action that can either use autowire
config/routes.json
[
{
"path": "/path/(\\d+)",
"controller": "App\\Controller\\FooController::show"
}
]
This project is licensed under the MIT License