tinylara/tinyrouter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tinylara/tinyrouter

最新稳定版本:v2.2

Composer 安装命令:

composer require tinylara/tinyrouter

包简介

Tiny PHP router based on Macaw.

README 文档

README

Latest Stable Version Total Downloads License

TinyRouter is a tiny PHP router based on Macaw. Read the documentation.

Install

If you have Composer, just include TinyRouter as a project dependency in your composer.json. If you don't just install it by downloading the .ZIP file and extracting it to your project directory.

require: {
    "tinylara/tinyrouter": "*"
}

Examples

use TinyLara\TinyRouter\TinyRouter as Route;

Route::get('/', 'HomeController@home');

// GET
Route::get('foo', function() {
  echo "GET Foo!";
});
// POST
Route::post('foo', function() {
  echo "POST Foo!";
});
// ANY: GET or POST
Route::any('foo', function() {
  echo "ANY Foo!";
});

Route::error(function() {
  throw new Exception("404 Not Found");
});

Route::dispatch();

The Route::dispatch() function can receive a parameter as the Processor After. It will process the value returned by Controller. Example:

Route::dispatch('View@process');

If you don't specify an error callback, it will just echo `404`.

License

The TinyRouter is open-sourced software licensed under the MIT license

统计信息

  • 总下载量: 658
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-15