2017 © Pedro Peláez
 

library cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

image

middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

  • Thursday, January 25, 2018
  • by oscarotero
  • Repository
  • 2 Watchers
  • 6 Stars
  • 5,483 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 36 % Grown

The README.md

middlewares/cors

Latest Version on Packagist ![Software License][ico-license] Testing ![Total Downloads][ico-downloads], (*1)

Middleware to implement Cross-Origin Resource Sharing (CORS) using neomerx/cors-psr7., (*2)

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/cors., (*3)

composer require middlewares/cors

Example

use Neomerx\Cors\Strategies\Settings;
use Neomerx\Cors\Analyzer;

$settings = new Settings();
$settings->setServerOrigin('http', 'example.com', 123);

$analyzer = Analyzer::instance($settings);

$dispatcher = new Dispatcher([
    new Middlewares\Cors($analyzer)
]);

$response = $dispatcher->dispatch(new ServerRequest());

Usage

You have to provide a Neomerx\Cors\Contracts\AnalyzerInterface to the constructor. See neomerx/cors-psr7 for more info. Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface as the second argument to create the responses. If it's not defined, Middleware\Utils\Factory will be used to detect it automatically., (*4)

$analyzer = Analyzer::instance($settings);
$responseFactory = new MyOwnResponseFactory();

$cors = new Middlewares\Cors($analyzer, $responseFactory);

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details., (*5)

The MIT License (MIT). Please see LICENSE for more information., (*6)

The Versions

25/01 2018

dev-master

9999999-dev https://github.com/middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 cors security http psr-15 cross-origin

25/01 2018

v1.0.0

1.0.0.0 https://github.com/middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 cors security http psr-15 cross-origin

13/11 2017

v0.5.0

0.5.0.0 https://github.com/middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 cors security http psr-15 cross-origin

21/09 2017

v0.4.0

0.4.0.0 https://github.com/middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 cors security http psr-15 cross-origin

26/12 2016

v0.3.0

0.3.0.0 https://github.com/middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 cors security http psr-15 cross-origin

27/11 2016

v0.2.0

0.2.0.0 https://github.com/middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 cors security http psr-15 cross-origin

09/10 2016

v0.1.0

0.1.0.0 https://github.com/middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 cors security http psr-15 cross-origin