cspray/labrador-http-cors 问题修复 & 功能扩展

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

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

cspray/labrador-http-cors

最新稳定版本:1.0.0

Composer 安装命令:

composer require cspray/labrador-http-cors

包简介

An Amp http-server middleware library to facilitate CORS

README 文档

README

GitHub release GitHub license

A PHP 8+ library intended to provide spec-compliant CORS middleware for projects running on Amp's http-server. Though this library lives under the Labrador namespace it has only one dependency, amphp/http-server, and does not depend on any other Labrador packages.

Installation

Composer is the only supported method for installing Labrador packages.

composer require cspray/labrador-http-cors

Example

Below is an example using the fluent API. Please check out the documentation for more details and examples of non-fluent usage.

<?php

use Cspray\Labrador\Http\Cors\ConfigurationBuilder;
use Cspray\Labrador\Http\Cors\SimpleConfigurationLoader;
use Cspray\Labrador\Http\Cors\CorsMiddleware;

$configuration = ConfigurationBuilder::forOrigins('https://example.com', 'https://foo.example.com')
    ->allowMethods('GET', 'POST', 'PUT', 'DELETE')
    ->withMaxAge(8600)
    ->allowRequestHeaders('X-Request-Header')
    ->exposeResponseHeaders('X-Response-Header')
    ->doAllowCredentials()
    ->build();
$loader = new SimpleConfigurationLoader($configuration);
$middleware = new CorsMiddleware($loader);

Supported Versions

Only the 1.x release series is officially supported at this time. The previous 0.x release series will not see new features and will only see critical security fixes.

Documentation

Labrador packages have thorough documentation in-repo in the docs/ directory. You can also check out the documentation online at https://labrador-kennel.io/docs/http-cors.

Governance

All Labrador packages adhere to the rules laid out in the Labrador Governance repo.

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-02-10