| Package Data | |
|---|---|
| Maintainer Username: | abellion |
| Maintainer Contact: | antoinebellion@msn.com (Antoine Bellion) |
| Package Create Date: | 2016-10-09 |
| Package Last Update: | 2017-02-09 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-29 03:04:24 |
| Package Statistics | |
|---|---|
| Total Downloads: | 3,076 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 1 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
#Laravel CORS
composer require abellion/laravel-cors
Abellion\Cors\LaravelServiceProvider::class
providers array of the config/app.php filebootstrap/app.php file using the $app->register(); method.You're all set ! All origins are allowed by default. If you want to config your own domains, see bellow.
By default all origins are allowed. You can add your own config by modifying the ORIGINS array from the OriginsMiddleware class :
use Abellion\Cors\Middleware\OriginsMiddleware;
OriginsMiddleware::$ORIGINS = [
"/https:\/\/(www\.)?([a-z0-9]+\.)?mydomain\.(com|fr)/",
"/http(s)?:\/\/(www\.)?localhost(:[0-9]+)?/"
];
All origins that match one of the regex will be added. In this example localhost and mydomain are allowed.
use Abellion\Cors\Middleware\OptionsMiddleware;
OptionsMiddleware::$OPTIONS['Access-Control-Allow-Methods'] = "POST, PUT, DELETE, GET, OPTIONS, PATCH, HEAD";