Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/havenshen/slim-cors
This repository contains a Slim Framework CORS middleware.
https://github.com/havenshen/slim-cors
cors framework middleware slim
Last synced: 3 days ago
JSON representation
This repository contains a Slim Framework CORS middleware.
- Host: GitHub
- URL: https://github.com/havenshen/slim-cors
- Owner: HavenShen
- License: mit
- Created: 2017-03-24T05:18:43.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-24T09:01:21.000Z (almost 8 years ago)
- Last Synced: 2024-12-20T07:41:22.602Z (16 days ago)
- Topics: cors, framework, middleware, slim
- Language: PHP
- Size: 14.6 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Slim Framework CORS Protection
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/?branch=master)
[![Build Status](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/badges/build.png?b=master)](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/build-status/master)
[![Code Coverage](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/?branch=master)
[![Build Status](https://travis-ci.org/HavenShen/Slim-Cors.svg?branch=master)](https://travis-ci.org/HavenShen/Slim-Cors)
[![Latest Stable Version](https://poser.pugx.org/HavenShen/Slim-Cors/v/stable.svg)](https://packagist.org/packages/HavenShen/Slim-Cors)
[![Latest Unstable Version](https://poser.pugx.org/HavenShen/Slim-Cors/v/unstable.svg)](https://packagist.org/packages/HavenShen/Slim-Cors)
[![Latest Stable Version](https://img.shields.io/packagist/v/HavenShen/Slim-Cors.svg?style=flat-square)](https://packagist.org/packages/HavenShen/Slim-Cors)
[![Total Downloads](https://img.shields.io/packagist/dt/HavenShen/Slim-Cors.svg?style=flat-square)](https://packagist.org/packages/HavenShen/Slim-Cors)
[![License](https://img.shields.io/packagist/l/HavenShen/Slim-Cors.svg?style=flat-square)](https://packagist.org/packages/HavenShen/Slim-Cors)This repository contains a Slim Framework CORS middleware.
## Install
Via Composer
``` bash
$ composer require havenshen/slim-cors
```Requires Slim 3.0.0 or newer.
## Usage
In most cases you want to register HavenShen\Slim\Cors.
### Register
```php
$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
``` bash
$ phpunit
```## Development progress
continues to update...
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.