We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
The router object sends all method calls through the when method using either a 1 or 2 parameter call.
when
Accepts 2 parameters: route and controller. Used for defining a route that matches any method.
$tipsy->router()->when('hello',function() { echo 'World'; });
Accepts 1 parameter: controller. Used for specifying the home page. This is equivalent to specifying an empty '' or '/' when method.
''
'/'
$tipsy->router()->home(function() { echo 'Honey, Im home!'; });
Accepts 2 parameters: route and controller. Used for defining a route with a specific method. You can use absolutely any method. Even made up ones.
$tipsy->router()->post(function() { echo 'Yay! Posting stuff!'; }); $tipsy->router()->bacon(function() { echo 'This is a bacon method!'; });
Accepts parameter: controller. If no match is found, the otherwise function will be called. Used for default, or 404 pages.
$tipsy->router()->otherwise(function() { echo '404'; });