Giter VIP home page Giter VIP logo

lumen-cors's Introduction

Lumen CORS

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

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

NOTE: Branch 5.3 uses Lumen framework 5.3. Only bug-fixes 1.7.X should be tagged in the 5.3 branch.

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 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
  • origin_not_allowed callable Creates the response if the origin is not allowed
  • method_not_allowed callable Creates the response if the method is not allowed
  • header_not_allowed callable Creates the response if the header is not allowed

Bootstrapping

Add the following lines to bootstrap/app.php:

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

The module now automatically handles all CORS requests.

Contributing

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:

vendor/bin/codecept run unit

License

See LICENSE.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.