'; }); //accept only numbers as the second parameter. Other chars will result in a 404 Route::add('/foo/([0-9]*)/bar',function($var1){ //Do something echo $var1.' is a great number!'; }); //long route Route::add('/foo/bar/foo/bar',function(){ //Do something echo 'hehe :-)
'; }); //crazy route with parameters (Will be triggered on the route pattern above too because it matches too) Route::add('/(.*)/(.*)/(.*)/(.*)',function($var1,$var2,$var3,$var4){ //Do something echo 'You have entered: '.$var1.' / '.$var2.' / '.$var3.' / '.$var4.'
'; }); Route::add('/api/v1/deployment/(.*)',function($id){ //Do something echo $id; }); Route::add('/deployment/(.*)',function($id){ //Do something echo $id; }); //Add a 404 Not found Route Route::add404(function($url){ //Send 404 Header header("HTTP/1.0 404 Not Found"); echo '404 :-(
'; echo $url.' not found!'; }); Route::run();