2017 © Pedro Peláez
 

library openroutes

route for PHP

image

openroutes/openroutes

route for PHP

  • Tuesday, July 19, 2016
  • by jackeq
  • Repository
  • 1 Watchers
  • 2 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

openroutes

轻量级php路由, (*1)

安装

编辑composer.json, (*2)

{
    "require": {
        "openroutes/openroutes": "dev-master",
    }
}

执行 composer update, (*3)

使用

require './vendor/autoload.php';
use \openroutes\openroutes\openroutes;
openroutes::get('index', function () {
    echo 'index';
});
openroutes::run();

示例

get/post/delete/put
openroutes::get('article/info', function () {
     echo 'article/info';
});
any
openroutes::any('article/info', function () {
     echo 'article/info';
});
match
openroutes::match(['get', 'post'], 'article/info', function () {
     echo 'article/info';
});
带参数
openroutes::get('article/id/{$id}', function ($id) {
     echo 'article/id'.$id;
});
参数验证
openroutes::get('article/id/{$id}', function ($id) {
     echo 'article/id'.$id;
})->verify(['id' => '/^[0-9]*$/']);

12321321, (*4)

The Versions

19/07 2016

dev-master

9999999-dev

route for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by jiangkaiqiang

route openroutes