Last active
August 29, 2015 14:08
-
-
Save eimihar/f4dbe17a73c990c80906 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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