CORS module for the Lumen PHP framework.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
config Simplify the service by removing support for defining custom callback… Oct 10, 2018
src Don't set any additional headers if the origin is not allowed Nov 13, 2018
tests Do not set the Vary response header if all origins are allowed Nov 13, 2018
.gitignore Don't track composer.lock, ignore it Oct 8, 2018
.scrutinizer.yml Add more tests Nov 21, 2016
.styleci.yml Exclude the whole tests/_support directory from StyleCI analysis Oct 10, 2018
.travis.yml Update the minimum PHP version to 7.1 Oct 9, 2018 Add back the keepachangelog mention Nov 14, 2018
LICENSE Initial commit May 13, 2015 Update the Scrutinizer badge Oct 10, 2018
codeception.yml Add code coverage via Coveralls Apr 8, 2016
composer.json Add phpstan for static analysis, fix a few minor issues Oct 10, 2018
phpstan.neon Fix phpstan error Nov 13, 2018

Lumen CORS

Build Status Coverage Status Code Climate Scrutinizer Code Quality StyleCI Latest Stable Version Total Downloads License

Cross-Origin Resource Sharing (CORS) module for the Lumen PHP framework.




Run the following command to install the package through Composer:

composer require nordsoftware/lumen-cors


Copy the configuration template in config/cors.php to your application's config directory and modify according to your needs. For more information see the Configuration Files section in the Lumen documentation.

Available configuration options:

  • allow_origins array Origins that are allowed to perform requests, defaults to an empty array
  • allow_methods array HTTP methods that are allowed, defaults to an empty array
  • allow_headers array HTTP headers that are allowed, defaults to an empty array
  • allow_credentials boolean Whether or not the response can be exposed when credentials are present, defaults to false
  • expose_headers array HTTP headers that are allowed to be exposed to the web browser, defaults to an empty array
  • max_age integer Indicates how long preflight request can be cached, defaults to 0


Add the following lines to bootstrap/app.php:


The module now automatically handles all CORS requests.


Please read the guidelines.

Running tests

Clone the project and install its dependencies by running:

composer install

Run the following command to run the test suite:

composer test