Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
 
 
src
 
 
 
 
 
 
 
 
 
 

Router

OliveCMS Router with host handle

Installation

Install the latest version with

$ composer require olive-cms/router

If you do not use Composer, you can download composered zip from release Github page

Basic Usage

require_once 'vendor/autoload.php';
use 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');

Documentation

Requirements

  • PHP 5.5+.

License

olive-cms/router is licensed under the MIT license.