Simple HTTP Router implementing the Front Controller pattern for MVC architecture.
More...
|
| | add (string $method, string $path, array $handler) |
| | Registers a new route in the application.
|
| |
| | dispatch (string $method, string $uri) |
| | Matches the incoming request to a registered route and dispatches it.
|
| |
Simple HTTP Router implementing the Front Controller pattern for MVC architecture.
◆ add()
| App\Core\Router::add |
( |
string | $method, |
|
|
string | $path, |
|
|
array | $handler ) |
Registers a new route in the application.
- Parameters
-
| string | $method | The HTTP method (GET, POST, DELETE, etc.). |
| string | $path | The URL endpoint (supports regex tokens like {id}). |
| array | $handler | Callable array referencing [Controller::class, 'methodName']. |
◆ dispatch()
| App\Core\Router::dispatch |
( |
string | $method, |
|
|
string | $uri ) |
Matches the incoming request to a registered route and dispatches it.
- Parameters
-
| string | $method | The requested HTTP method. |
| string | $uri | The requested URI path. |
◆ $routes
| array App\Core\Router::$routes = [] |
|
private |
The documentation for this class was generated from the following file: