qlimix/http-cors-middleware

PSR15 CORS middleware implementation

2.0.0 2020-11-21 16:07 UTC

This package is auto-updated.

Last update: 2024-10-22 00:48:46 UTC


README

Travis CI Coveralls Packagist MIT License

PSR15 cors middleware implementation

Install

Using Composer:

$ composer require qlimix/http-cors-middleware

usage

<?php

use Neomerx\Cors\Analyzer;
use Neomerx\Cors\Strategies\Settings;
use Neomerx\Cors\Factory\Factory;
use Qlimix\HttpMiddleware\CorsMiddleware;

$analyzer = new Analyzer(new Settings(), new Factory());
$responseFactory = new ResponseFactoryImplementation();

$corsMiddleware = new CorsMiddleware($analyzer, $responseFactory);

// add to middleware request handler

Testing

To run all unit tests locally with PHPUnit:

$ vendor/bin/phpunit

Quality

To ensure code quality run grumphp which will run all tools:

$ vendor/bin/grumphp run

Contributing

Please see CONTRIBUTING for details.