Skip to content

App Route Shorthand

Devin Smith edited this page Dec 13, 2015 · 3 revisions

The App object exposes and forwards the get, post and when methods to its $this->router() method for shorthand route creation. All arguments passed theses functions are passed on to the router.

$app->get('user/:name', function($Params) {
	echo $Params->name;
});

or

$app->when([
	'route' => 'user/:name',
	'method' => 'get',
	'controller' => function($Params) {
		echo $Params->name
	}
]);

See Routes for more information.