New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

abellion/laravel-cors

Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application
3,076 1

Larablocks Analysis

abellion/laravel-cors works with any PHP project: the latest release (1.0.2, Oct 10, 2016) doesn't depend on Laravel.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • No release in the last 12 months (last: Jan 25, 2017)
  • 0 downloads a month (needs 10,000)
  • 1 GitHub star (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Jan 25, 2017.
  • No releases in the last 12 months.
  • First released: Oct 10, 2016.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.

Install
composer require abellion/laravel-cors
Latest Version:1.0.2
License:MIT
Last Updated:Feb 9, 2017
Links: GitHub  ·  Packagist
Maintainer: abellion

#Laravel CORS

Add CORS to your Laravel/Lumen app in 2 steps :

Require the package :
composer require abellion/laravel-cors
Add the service provider to your app :
Abellion\Cors\LaravelServiceProvider::class
  • Laravel : In the providers array of the config/app.php file
  • Lumen : In the bootstrap/app.php file using the $app->register(); method.

You're all set ! All origins are allowed by default. If you want to config your own domains, see bellow.

Configuring allowed origins :

By default all origins are allowed. You can add your own config by modifying the ORIGINS array from the OriginsMiddleware class :

use Abellion\Cors\Middleware\OriginsMiddleware;

OriginsMiddleware::$ORIGINS = [
    "/https:\/\/(www\.)?([a-z0-9]+\.)?mydomain\.(com|fr)/",
    "/http(s)?:\/\/(www\.)?localhost(:[0-9]+)?/"
];

All origins that match one of the regex will be added. In this example localhost and mydomain are allowed.

Configuring other headers :

use Abellion\Cors\Middleware\OptionsMiddleware;

OptionsMiddleware::$OPTIONS['Access-Control-Allow-Methods'] = "POST, PUT, DELETE, GET, OPTIONS, PATCH, HEAD";

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released License
1.0.2 MIT
1.0.1 MIT
1.0.0 MIT