carlosocarvalho / router
PHP router
1.0.0
2015-05-26 00:47 UTC
This package is auto-updated.
Last update: 2024-10-29 04:20:00 UTC
README
Simple Routers PHP
get('/',function(){ echo 'home page'; }); $router->get('/posts/:id-:slug',function($id, $slug) use ($router){ echo $router->url('Blog#show',['id'=>1,'slug'=>'slugsd-idads']); },'posts.show')->with('id','[0-9]+')->with('slug','([a-z\-0-9]+)'); $router->get('/posts/:id','Blog#show'); $router->post('/posts/:id',function($id){ print_r($_POST); }); $router->run(); ### Use Custom Controllers $router->get('/posts','Blog#show'); Create new Controller BlogController.phpExamples