havenshen/slim-cors

Slim Framework 3 CORS middleware

v1.0.0 2017-03-24 08:59 UTC

This package is auto-updated.

Last update: 2020-07-22 05:03:46 UTC


README

Scrutinizer Code Quality Build Status Code Coverage Build Status Latest Stable Version Latest Unstable Version Latest Stable Version Total Downloads License

This repository contains a Slim Framework CORS middleware.

Install

Via Composer

$ composer require havenshen/slim-cors

Requires Slim 3.0.0 or newer.

Usage

In most cases you want to register HavenShen\Slim\Cors.

Register

$app = new \Slim\App([
    'settings' => [
        'dispayErrorDetails' => true,
    ]
]);

$container = $app->getContainer();

$container['cors'] = function ($c) {
    return new \HavenShen\Slim\Cors\Guard;
};

$app->add($container->get('cors'));

Testing

$ phpunit

Development progress

continues to update...

License

The MIT License (MIT). Please see License File for more information.