承接 kaz29/cakephp-cors-middleware-plugin 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kaz29/cakephp-cors-middleware-plugin

最新稳定版本:1.2.0

Composer 安装命令:

composer require kaz29/cakephp-cors-middleware-plugin

包简介

CorsMiddleware plugin for CakePHP

README 文档

README

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require kaz29/cakephp-cors-middleware-plugin 

Minimum setup

  • Add the following configuration into config/app_local.php.
 'App' => [ 'cors' => [ 'allowUrls' => [ 'https://example.com', // your web site urls 'https://app.example.com', ], ], ], 

OR

When injecting with environment variables, it looks like this...

 'App' => [ 'cors' => [ 'allowUrls' => explode(',', env('CORS_ALLOW_URL', '')) ], ], 
  • Add load middleware setting into Application::middleware method.
 public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue { $middlewareQueue ->add(new CorsMiddleware(Configure::read('App.cors'))) // Add this line // Catch any exceptions in the lower layers, // and make an error page/response ->add(new ErrorHandlerMiddleware(Configure::read('Error'))) 

Customize settings

 'App' => [ 'cors' => [ 'allowUrls' => [ 'https://example.com', // your web site urls 'https://app.example.com', '/^http:\/\/localhost:(\d+)$/', // regular expression support ], 'allowMethods' => [ 'GET', 'POST', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', ], 'allowHeaders' => [ 'Accept-Language', 'content-type', 'Accept', 'Origin', 'Cookie', 'Content-Length', 'Authorization', ], 'exposeHeaders' => [], ], ], 

Author

Kazuhiro Watanabe - cyo [at] mac.com - https://twitter.com/kaz_29

License

CorsMiddleware plugin for CakePHP is licensed under the MIT License - see the LICENSE file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固