Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olivecms/router
OliveCMS Router with host handle
https://github.com/olivecms/router
arshen composer easy-router olive-cms php php-router router
Last synced: about 5 hours ago
JSON representation
OliveCMS Router with host handle
- Host: GitHub
- URL: https://github.com/olivecms/router
- Owner: OliveCMS
- License: mit
- Created: 2018-08-25T10:14:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-31T07:52:40.000Z (almost 6 years ago)
- Last Synced: 2024-04-23T11:17:47.986Z (7 months ago)
- Topics: arshen, composer, easy-router, olive-cms, php, php-router, router
- Language: PHP
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/OliveCMS/Router/releases/latest)
## Basic Usage
``` php
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
- [Usage Instructions](doc/01-usage.md)
## Requirements
- PHP 5.5+.
## License
olive-cms/router is licensed under the [MIT license](http://opensource.org/licenses/MIT).