Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lumen CORS

Build Status Latest Stable Version Total Downloads License

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

Requirements

Usage

Installation

Run the following command to install the package through Composer:

composer require nordsoftware/lumen-cors

Configure

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

Available configuration options:

  • allowOrigins - Origins that are allowed to perform requests, defaults to an empty array
  • allowHeaders - HTTP headers that are allowed, defaults to an empty array
  • allowMethods - HTTP methods that are allowed, defaults to an empty array
  • allowCredentials - Whether or not the response can be exposed when credentials are present, defaults to false
  • exposeHeaders - HTTP Headers that are allowed to be exposed to the web browser, defaults to an empty array
  • maxAge - Indicates how long preflight request can be cached, defaults to 0

Bootstrapping

Add the following lines to bootstrap/app.php:

$app->configure('cors');
$app->register('Nord\Lumen\Cors\CorsServiceProvider');
$app->middleware([
	.....
	'Nord\Lumen\Cors\Middleware\CorsMiddleware',
]);

The module now automatically handles all CORS requests.

Contributing

Please note the following guidelines before submitting pull requests:

  • Use the PSR-2 coding style
  • All new features must be covered by unit tests
  • Always create pull requests to the develop branch

Running tests

Clone the project and install its dependencies by running:

composer install

Run the following command to run the test suite:

vendor/bin/codecept run unit

License

See LICENSE.

About

CORS module for the Lumen PHP framework.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages