darktec / router
Routing package for PHP 7
1.0.6
2020-02-13 00:25 UTC
Requires
- php: >=7.4
- darktec/util: 1.0.*
- doctrine/cache: 1.0
- php-di/php-di: ^5.1
Requires (Dev)
- phpunit/phpunit: 5.0.*
README
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
Install
To install router as a Composer package run:
$ composer require darktec/router
Usage
First initialize the router
Router::init();
Then create your mappings using METHOD, ROUTE, ACTION where ACTION is a function
Router::map('GET', '/', '\package\controller@function'); // OR Router::map('GET', '/', function() { echo 1; });
Finally match the request method and URI
Router::match($method, $uri);
If a match is found then the function defined is invoked.
Change log
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Credits
License
The MIT License (MIT). Please see License File for more information.