PHP code example of olive-cms / router
1. Go to this page and download the library: Download olive-cms/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/ */
olive-cms / router example snippets
php
Olive\Router;
$router = new Router();
$router->addHost('https://arshen.ir/', 1);
$router->addHost('https://blog.arshen.ir/', 2);
// global route
$router->add('/api', function(){
return 'api area!';
});
// host 1 (https://arshen.ir/) route
$router->add('/login', function(){
return 'login area! only use in https://arshen.ir/';
}, [], 1);
// not found route
$router->addNotFound('not found');
// render address
echo $router->render('https://arshen.ir/login');