Skip to content

Commit

Permalink
🎉 Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenShen committed Mar 24, 2017
1 parent 0bdab5c commit 7c5c895
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,46 @@
[![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.
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('csrf'));
```

## Testing

``` bash
$ phpunit
```

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 comments on commit 7c5c895

Please sign in to comment.