Skip to content

Instantly share code, notes, and snippets.

@eimihar
Last active August 29, 2015 14:08
Show Gist options
  • Save eimihar/f4dbe17a73c990c80906 to your computer and use it in GitHub Desktop.
Save eimihar/f4dbe17a73c990c80906 to your computer and use it in GitHub Desktop.
<?php
## within application building container.
## 1. initiate pm routes
$app->map->addRoute(Array(
'pm'=>Array(
'method'=>'any',
'uri'=>'pm',
'subroute'=>Array(),
'bind:execute'=>function($param,$execution)
{
// do authentication or anything here.
// do main execution on behalf of the framework. (you may pass parameter if you want.)
return $execution($param);
}
)
));
## 2. append all these routes into pm, later these route may be accessed with uri respectively or by route name. (pm.inbox, or pm.sent, or pm.view)
$routes = Array(
'inbox'=>Array('get','inbox',function(){ }),
'sent'=>Array('get','sent',function(){ }),
'view'=>Array('get','view/[:id]',function(){ })
);
$app->map->addRoute('pm',$routes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment