jkirkby91/lumenpsr7cors

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.1.0) of this package.

1.1.0 2017-12-07 05:20 UTC

This package is not auto-updated.

Last update: 2021-01-19 07:23:56 UTC


README

Cross-origin resource sharing (CORS) Middleware for Lumen micro-framework.

Latest Stable Version

Installation

After you install lumen as per lumen docs, install lumen-cors from lumen folder.

Install with Composer

Run composer require "Jkirkby91-2/LumenPSR7Cors" to install lumen-cors.

Usage

Global CORS

If you want CORS enabled for every HTTP request to your application, simply list the middleware class Jkirkby91\LumenPSR7Cors\Http\Middleware\Cors in the $app->middleware() call of your bootstrap/app.php file.

CORS for Routes

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' => 'Jkirkby91\LumenPSR7Cors\Http\Middleware\Cors',
]);

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

License

MIT