PHP router.
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();
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']]);
Snatch is licensed under MIT License.