Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
docs: Added using by slim doc
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Apr 11, 2018
1 parent 78c4fc0 commit 5985fe0
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/using-by-slim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Using by Slim framework

`medz/cors` package supported [Slim framework 3](https://github.com/slimphp/Slim).

## Configure

See 👉[Configure example](https://github.com/medz/cors#configure).

## Using

Slim frameowk supported class name is `Medz\Cors\Slim\Cors`, Simple use:

```php
$app = new Slim\App();
$app->add(new Medz\Cors\Slim\Cors);
```

> 💡Slim framework middleware using see https://www.slimframework.com/docs/v3/concepts/middleware.html
### Using Settings

```php
$settings = [
// The configure see https://github.com/medz/cors#configure
];
$app = new Slim\App();
$app->add(new Medz\Cors\Slim\Cors($settings));
```

### Using custom CORS instance

```php
$cors = // Todo, The instance is \Medz\Cors\CorsInterface::class
$app = new Slim\App();
$app->add(new Medz\Cors\Slim\Cors($cors));
```

## CORS middleware `__construct`

- payload: This is Medz\Cors\CorsInterface or array or null
- append: The type is boolean, If using `true`, All request set CORS to response hraders.

0 comments on commit 5985fe0

Please sign in to comment.