olive-cms/router

OliveCMS Router with host handle

1.0.1 2018-12-31 07:51 UTC

This package is auto-updated.

Last update: 2024-08-29 04:43:13 UTC


README

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.