Skip to content
/ router Public

🚦 Route http requests to controller actions

License

Notifications You must be signed in to change notification settings

seeren/router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seeren\Router

Build Require Coverage Download Codacy Version

Route http requests to controller actions


Installation

composer require seeren/router

Seeren\Router\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();

Configuration

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"
  }
]

License

This project is licensed under the MIT License

About

🚦 Route http requests to controller actions

Topics

Resources

License

Stars

Watchers

Forks

Languages