tenantcloud/laravel-cors 问题修复 & 功能扩展

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

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

tenantcloud/laravel-cors

最新稳定版本:v3.0.0

Composer 安装命令:

composer require tenantcloud/laravel-cors

包简介

Send CORS headers in a Laravel application

README 文档

README

Laravel package for CORS, with support for custom CORS profiles per route.

Installation

In your composer.json, add this repository:

"repositories": [ { "type": "git", "url": "https://github.com/tenantcloud/laravel-cors" } ], 

Then do composer require tenantcloud/laravel-cors to install the package. After, publish the config: php artisan vendor:publish and select needed config file.

Usage

You want to use a single, global CORS per project

If you want to use a global profile, add CorsMiddleware::class into your Http\Kernel.php's $middleware. default profile from the config will be used.

You want to use multiple different CORS profiles per route

If you need a scoped CORS, you should:

  1. Add wanted config to cors.php
  2. Add 'cors' => CorsMiddleware::class into your Http\Kernel.php's $routeMiddleware.
  3. Add cors:your_profile to route you want to have CORS on.
  4. Add OPTIONS to list of supported methods for that route.

Example:

Route::match(['GET', 'OPTIONS'], '/test', 'Controller@test')->middleware('cors:test_profile'); 

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固