mikeismint / fruit
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/mikeismint/fruit
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: ~4.5
This package is not auto-updated.
Last update: 2026-01-18 00:24:54 UTC
README
My first attempt at a simple PHP router. Influenced by AltoRouter
Usage
$router = new Fruit(); // map single route $router->addRoute('GET', '/', 'Controller#Method'); // map post details page $router->addRoute('GET', '/^posts\/id\/(?P<id>\d+)$/', 'Controller#Method'); // map multiple routes $router->addRoutes(array( array('GET', '/', 'Controller#Method'), array('GET', '/^posts\/id\/(?P<id>\d+)$/', 'Controller#Method'), ));
Other features
- Accepts multiple HTTP methods separated by
| - Uses regex to match URL pattern
- Accepts optional fourth parameter to name routes