PHP code example of openlss / lib-router

1. Go to this page and download the library: Download openlss/lib-router library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

openlss / lib-router example snippets


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'));

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'
));