Router for handling web calls, allows dynamic registration at runtime
use \LSS\Router;
Router::init();
Router::_get()->setRoot(ROOT);
Router::_get()->setDefault('/ctl/home.php');
Router::_get()->register('client','list'=>'/ctl/client_list.php');
$dest = Router::_get()->route(get('act'),get('do'),get('fire'));
require($dest);
Calls the construct and starts the singleton
Returns the current instance
Sets the default file to route too. Relative to root.
Set the root folder that all route calls are relative to.
A more in depth example
Router::_get()->register('client',array(
'list' => '/ctl/client_list.php'
,'edit' => '/ctl/client_edit.php'
,'create' => '/ctl/client_create.php'
,'manage' => array( //this is a tiertiary segment
'contacts' => '/ctl/client_manage_contacts.php'i
//set the default when the third segment is missing
Router::DEF => '/ctl/client_manage.php'
)
//set the default when the second segment is missing
,Router::DEF => '/ctl/client_list.php'
));
Language | php |
Version | 0.0.0 |
Git URL | https://github.com/nullivex/lib-router |
License | GPL-3.0 |
Description | Router for handling web calls, allows dynamic registration at runtime |
Keywords |