All Projects → digiaonline → Lumen Cors

digiaonline / Lumen Cors

Licence: mit
CORS module for the Lumen PHP framework.

Labels

Projects that are alternatives of or similar to Lumen Cors

Lumen Jwt
Lumen with JWT Authentication, Dingo API and CORS Support
Stars: ✭ 258 (+193.18%)
Mutual labels:  lumen, cors
Public Cakephp Rest Api
CakePHP 3 plugin for building REST API services
Stars: ✭ 71 (-19.32%)
Mutual labels:  cors
Node Typescript Koa Rest
REST API boilerplate using NodeJS and KOA2, typescript. Logging and JWT as middlewares. TypeORM with class-validator, SQL CRUD. Docker included. Swagger docs, actions CI and valuable README
Stars: ✭ 739 (+739.77%)
Mutual labels:  cors
Java Sec Code
Java web common vulnerabilities and security code which is base on springboot and spring security
Stars: ✭ 1,033 (+1073.86%)
Mutual labels:  cors
Corsy
CORS Misconfiguration Scanner
Stars: ✭ 756 (+759.09%)
Mutual labels:  cors
Kickstarts
💻 No setup, just development!
Stars: ✭ 57 (-35.23%)
Mutual labels:  lumen
Laravel Elasticsearch
An easy way to use the official Elastic Search client in your Laravel applications.
Stars: ✭ 717 (+714.77%)
Mutual labels:  lumen
Laravel Sqs Fifo Queue
Adds a Laravel queue driver for Amazon SQS FIFO queues.
Stars: ✭ 75 (-14.77%)
Mutual labels:  lumen
Laravel Api Boilerplate Jwt
A Laravel 5.8 API Boilerplate to create a ready-to-use REST API in seconds.
Stars: ✭ 1,155 (+1212.5%)
Mutual labels:  cors
Lumen Doctrine
Doctrine module for the Lumen PHP framework.
Stars: ✭ 41 (-53.41%)
Mutual labels:  lumen
Http Basic Auth Guard
HTTP Basic Auth Guard for Lumen 5.x
Stars: ✭ 39 (-55.68%)
Mutual labels:  lumen
Jsonrpc
JsonRpc Server extension for Laravel/Lumen
Stars: ✭ 23 (-73.86%)
Mutual labels:  lumen
Laravel Health Check
A package for checking the health of your Laravel & Lumen applications
Stars: ✭ 59 (-32.95%)
Mutual labels:  lumen
Bugsnag Laravel
Bugsnag notifier for the Laravel PHP framework. Monitor and report Laravel errors.
Stars: ✭ 746 (+747.73%)
Mutual labels:  lumen
Rocket cors
Cross-origin resource sharing (CORS) for Rocket.rs applications
Stars: ✭ 73 (-17.05%)
Mutual labels:  cors
Learn Nginx
Nginx 入门指南
Stars: ✭ 728 (+727.27%)
Mutual labels:  cors
Freshdesk Laravel
Freshdesk Service Provider for Laravel 5 and Lumen
Stars: ✭ 14 (-84.09%)
Mutual labels:  lumen
Lumen Elasticsearch
Simple wrapper of https://github.com/elastic/elasticsearch-php for the Lumen PHP framework.
Stars: ✭ 56 (-36.36%)
Mutual labels:  lumen
Laravel Url Shortener
Powerful URL shortening tools in Laravel
Stars: ✭ 80 (-9.09%)
Mutual labels:  lumen
Lumen Api Oauth
A RESTful API based on Lumen micro-framework with OAuth2.
Stars: ✭ 73 (-17.05%)
Mutual labels:  lumen

Lumen CORS

GitHub Actions 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.

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. Patterns also accepted, for example *.foo.com
  • 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

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.

Customizing behavior

While the service can be configured somewhat using config/cors.php, some more exotic things such as regular expressions for allowed origins cannot. If you need to, you can provide this custom functionality yourself:

  1. Extend CorsService and override e.g. isOriginAllowed()
  2. Extend CorsServiceProvider and override registerBindings(), then register your own service class instead

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:

composer test

License

See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].