Cross-origin resource sharing (CORS) middleware & ServiceProvider for Lumen micro-framework.
dragonfire1119/cors-lumen is a Laravel package for cross-origin resource sharing (cors) middleware & serviceprovider for lumen micro-framework..
It currently has 3 GitHub stars and 474 downloads on Packagist (latest version v0.1.0).
Install it with composer require dragonfire1119/cors-lumen.
Discover more Laravel packages by dragonfire1119
or browse all Laravel packages to compare alternatives.
Last updated
Cross-origin resource sharing (CORS) Middleware for Lumen micro-framework.
Run composer require "dragonfire1119/cors-lumen:dev-master" to install cors-lumen.
If you want to allow OPTIONS method then your going to need to enable the CorsServiceProvider in the bootstrap/app.php file.
$app->register('Dragonfire1119\Cors\Providers\CorsServiceProvider');
If you want CORS enabled for every HTTP request to your application, simply list the middleware class Dragonfire1119\Cors\Middleware\CorsMiddleware 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 cors middleware a short-hand key in your bootstrap/app.php file.
$app->routeMiddleware([
'cors' => 'Dragonfire1119\Cors\Middleware\CorsMiddleware',
]);
Then, you use the key in the route options array.
$app->get('/api/test', ['middleware' => 'cors', function() {
//
}]);
More info. - http://lumen.laravel.com/docs/middleware#registering-middleware
If you have a change fork it & make a pull request. :)
Released under the MIT, see LICENSE.