PHPackages                             denismitr/laracors - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. denismitr/laracors

ActiveLibrary[HTTP &amp; Networking](/categories/http)

denismitr/laracors
==================

Cross Origin Resource Sharing Middleware for Laravel or Lumen

v0.6(8y ago)31131MITPHPPHP ^5.6 || ^7.0 || ^7.1

Since Jun 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/denismitr/laracors)[ Packagist](https://packagist.org/packages/denismitr/laracors)[ RSS](/packages/denismitr-laracors/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (9)Versions (3)Used By (0)

**LARACORS**
============

[](#laracors)

Laravel Cross Origin Resource Sharing Middleware
------------------------------------------------

[](#laravel-cross-origin-resource-sharing-middleware)

This middleware is designed specifically for the Laravel and Lumen frameworks and the **RESTful APIs** builded with them. It allows requests to made from JS frontends of other apps.

Author
------

[](#author)

**Denis Mitrofanov**

[TheCollection.ru](https://thecollection.ru)

Installation
------------

[](#installation)

---

Use composer to install the package:

```
composer require denismitr/laracors
```

### Laravel

[](#laravel)

Add to `config/app.php`:

```
'providers' => [
    ...
    \Denismitr\Laracors\LaravelCorsServiceProvider::class,
],
```

Include in your `app/Http/Kernel.php` to the appropriate section (all requests if all your routes are API or named middleware + API middleware group to make it work for every api route or just named middleware):

Global middleware
-----------------

[](#global-middleware)

```
protected $middleware = [
    ...
    \Denismitr\Laracors\Cors::class
];
```

Publish the config file:

```
php artisan vendor:publish  --provider="Denismitr\Laracors\LaravelCorsServiceProvider"
```

Edit the `config/laracors.php` file to your needs.

```
Named middleware
---------------
```php

protected $routeMiddleware = [
    ...
    'cors' => \Denismitr\Laracors\LaravelCorsServiceProvider::class,
];

protected $middlewareGroups = [
    'web' => [
        ...
    ],

    'api' => [
        ...
        'cors'
    ],
];

```

Middleware parameters

```
Route::put('post/{id}', function ($id) {
    //
})->middleware('cors:get,post,put');
```

Lumen
-----

[](#lumen)

Add the following lines to `bootstrap/app.php`:

```
$app->register('\Denismitr\Laracors\LumenCorsServiceProvider');
```

```
$app->middleware([
    .....
    '\Denismitr\Laracors\Cors',
]);
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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 ~0 days

Total

2

Last Release

3256d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d68ae5d5ca94f49a69f961a7825865d92247b09e276a25fcc6ad485d4c8c964?d=identicon)[denismitr](/maintainers/denismitr)

---

Top Contributors

[![denismitr](https://avatars.githubusercontent.com/u/16356446?v=4)](https://github.com/denismitr "denismitr (11 commits)")

---

Tags

httpmiddlewarelaravelcorslumen

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/denismitr-laracors/health.svg)

```
[![Health](https://phpackages.com/badges/denismitr-laracors/health.svg)](https://phpackages.com/packages/denismitr-laracors)
```

###  Alternatives

[matthewbdaly/laravel-etag-middleware

A Laravel middleware for adding ETags to HTTP requests to improve response times

64326.0k2](/packages/matthewbdaly-laravel-etag-middleware)[tomschlick/request-migrations

HTTP Request Migrations

1844.5k](/packages/tomschlick-request-migrations)[neomerx/cors-illuminate

CORS (Cross-Origin Resource Sharing) support for Laravel and Lumen

4996.4k2](/packages/neomerx-cors-illuminate)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)[laragear/json

Easily retrieve and manipulate `Json` across your application.

363.5k](/packages/laragear-json)

PHPackages © 2026

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