| Package Data | |
|---|---|
| Maintainer Username: | palanik |
| Package Create Date: | 2015-04-18 |
| Package Last Update: | 2018-04-09 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-18 15:03:07 |
| Package Statistics | |
|---|---|
| Total Downloads: | 231,560 |
| Monthly Downloads: | 1,359 |
| Daily Downloads: | 24 |
| Total Stars: | 101 |
| Total Watchers: | 5 |
| Total Forks: | 30 |
| Total Open Issues: | 8 |
Cross-origin resource sharing (CORS) Middleware for Lumen micro-framework.
After you install lumen as per lumen docs, install lumen-cors from lumen folder.
Run composer require "palanik/lumen-cors:dev-master" to install lumen-cors.
Copy the file LumenCors.php into app/Http/Middleware directory.
If you want CORS enabled for every HTTP request to your application, simply list the middleware class palanik\lumen\Middleware\LumenCors in the $app->middleware() call of your bootstrap/app.php file.
If you would like to enable CORS to specific routes, you should first assign the lumen-cors middleware a short-hand key in your bootstrap/app.php file.
$app->routeMiddleware([
'cors' => 'palanik\lumen\Middleware\LumenCors',
]);
Then, you use the key in the route options array.
$app->get('/data', ['middleware' => 'cors', function() {
//
}]);
More info. - http://lumen.laravel.com/docs/middleware#registering-middleware