PHPackages                             abellion/laravel-cors - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. abellion/laravel-cors

ActiveLibrary

abellion/laravel-cors
=====================

Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application

1.0.2(9y ago)13.1kMITPHP

Since Oct 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/abellion/laravel-cors)[ Packagist](https://packagist.org/packages/abellion/laravel-cors)[ RSS](/packages/abellion-laravel-cors/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

\#Laravel CORS

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

[](#add-cors-to-your-laravellumen-app-in-2-steps-)

#### Require the package :

[](#require-the-package-)

```
composer require abellion/laravel-cors

```

#### Add the service provider to your app :

[](#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 :
-----------------------------

[](#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 :
---------------------------

[](#configuring-other-headers-)

```
use Abellion\Cors\Middleware\OptionsMiddleware;

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Total

3

Last Release

3394d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e1567246b633341b38b84fd1d41baa7a141f534115a595830c03cf9179092c03?d=identicon)[abellion](/maintainers/abellion)

---

Top Contributors

[![abellion](https://avatars.githubusercontent.com/u/9916488?v=4)](https://github.com/abellion "abellion (5 commits)")

---

Tags

laravellaravel-corslumen

### Embed Badge

![Health badge](/badges/abellion-laravel-cors/health.svg)

```
[![Health](https://phpackages.com/badges/abellion-laravel-cors/health.svg)](https://phpackages.com/packages/abellion-laravel-cors)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
