Package Data | |
---|---|
Maintainer Username: | razor9999 |
Package Create Date: | 2016-01-19 |
Package Last Update: | 2016-01-19 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-12 15:02:11 |
Package Statistics | |
---|---|
Total Downloads: | 9 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Cross-origin resource sharing (CORS) Middleware for Lumen micro-framework.
Run composer require "razor9999/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('razor9999\Cors\Providers\CorsServiceProvider');
If you want CORS enabled for every HTTP request to your application, simply list the middleware class razor9999\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' => 'razor9999\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.