Snatch
PHP router.
Usage
To use this router you just need to require snatch.php
and create new instance of the Snatch
class. Then you will get full access to Snatch functionality.
require 'snatch.php';
$snatch = new Snatch;
$snatch->get('/', function () {
echo 'Hello, Snatch!';
});
$snatch->run();
Documentation
GET route
$snatch->get('/', function() {
echo 'Yay!';
});
POST route
$snatch->post('/', function() {
echo 'Yay!';
});
Handle 404
$snatch->missing(function() {
echo '404 error :c';
});
Add custom wildcard
// single
$snatch->wildcard('wldcrd', 'regex');
// multiple
$snatch->wildcard(['wldcrd1' => 'regex1', 'wldcrd2' => 'regex2']]);
License
Snatch is licensed under MIT License.