adrianschubek / router
A routing library for PHP
1.0
2020-04-14 19:52 UTC
Requires
- php: >=7.4
Requires (Dev)
- symfony/var-dumper: ^5.0
This package is auto-updated.
Last update: 2025-02-21 06:23:58 UTC
README
Features
- Easy to use
- Supports GET, POST, PUT, PATCH, DELETE & OPTIONS verbs
- Supports Route Parameters (Regex support)
- Middleware
- Route Groups
- Reverse Routing (Generate URL from Route Name)
- Subdirectory Routing
- Error Routes
- Implement Custom Resolver & Dispatcher
Installation
composer require adrianschubek/router
Example
use adrianschubek\Routing\Route; use adrianschubek\Routing\Router; $r = new Router(); $r->get("/", function () { echo "Hello stranger!"; }); $r->get("/[a]/[b]", function ($a, $b) { echo $a + $b; })->where("([0-9]+)"); $r->dispatch();