palanik/lumen-cors 问题修复 & 功能扩展

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

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

palanik/lumen-cors

最新稳定版本:v0.0.3

Composer 安装命令:

composer require palanik/lumen-cors

包简介

Cross-origin resource sharing (CORS) middleware for Lumen micro-framework.

README 文档

README

Cross-origin resource sharing (CORS) Middleware for Lumen micro-framework.

Latest Stable Version License

Installation

After you install lumen as per lumen docs, install lumen-cors from lumen folder.

Install with Composer

Run composer require "palanik/lumen-cors:dev-master" to install lumen-cors.

Manual Installation

Copy the file LumenCors.php into app/Http/Middleware directory.

Usage

Global CORS

If you want CORS enabled for every HTTP request to your application, simply list the middleware class palanik\lumen\Middleware\LumenCors in the $app->middleware() call of your bootstrap/app.php file.

CORS for Routes

If you would like to enable CORS to specific routes, you should first assign the lumen-cors middleware a short-hand key in your bootstrap/app.php file.

$app->routeMiddleware([
    'cors' => 'palanik\lumen\Middleware\LumenCors',
]);

Then, you use the key in the route options array.

$app->get('/data', ['middleware' => 'cors', function() {
    //
}]);

More info. - http://lumen.laravel.com/docs/middleware#registering-middleware

License

MIT

统计信息

  • 总下载量: 234.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 105
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 101
  • Watchers: 5
  • Forks: 30
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-18