Skip to content

maxdoom-com/routing.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

routing.php

This is a minimal set of routing functions for use with php.

Example:

<?php
@require('routing.php');

get('/', 'index');
function index()
{
	echo 1;
}

get('/([a-z]+)', function($tag){
	echo $tag;
});

get('/many', ['fn1', 'fn2']);
function fn1(){ echo 'fn1 called'; }
function fn2(){ echo 'fn2 called'; }

post('/do/something', 'Controller::do_sth');
class Controller
{
	public function do_sth()
	{
		var_dump($_POST);
	}
}

if( !dispatch() )
{
	die('404 - not found!');
}

About

a minimal set of routing functions for use with php

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages