four43 / divergence
Divergence is a PHP router for creating simple web APIs that can grow with your application by providing more features only when you need them.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/four43/divergence
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2025-12-16 12:42:06 UTC
README
A fast router for PHP, as easy, or as full featured as you need it.
Insipred by ToroRouter (https://github.com/anandkunal/ToroPHP), which is a great router to quickly create simple apps. Divergence aims to be almost as simple, but provide more features for larger apps.
Build Status
Features
- Simple - Single file rouder, commented and easy to understand.
- Debug - Provided debug handler, add it to your app temporarily to see what callbacks get called when, and with what data.
- Server Setup - Use provided server configs (.htaccess for Apache and web.config for IIS) to route all of your requests to your index.php file.
Example
###Basic
<?php $routes = array( '/v1/action/:number' => 'RestV1\Controller\Action' ); \Divegent\Router::serve($routes);
Will route /v1/action/123 to the controller RestV1\Controller\Action based
on the method, GET will call the get() method as get(123)
###Basic - Callback