Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

oxyberg/snatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Simple PHP router

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published