Skip to content
OliveCMS Router with host handle
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
src
.gitignore
CHANGELOG.md
LICENSE
README.md
composer.json

README.md

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.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.