Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

nshcore-archive/Lumenpsr7cors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lumen-CORS

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

About

A Lumen Cors Package That Supports PSR7 Requests

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages