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

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

zooxsmart/los-cors
==================

PHP CORS middleware

1.0.1(2y ago)04MITPHPPHP ^8.2

Since Oct 31Pushed 9mo agoCompare

[ Source](https://github.com/zooxsmart/los-cors)[ Packagist](https://packagist.org/packages/zooxsmart/los-cors)[ Docs](https://github.com/lansoweb/los-cors)[ RSS](/packages/zooxsmart-los-cors/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (4)Used By (0)

CORS Middleware for PHP
=======================

[](#cors-middleware-for-php)

This middleware handles CORS requests and adds cors headers

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

[](#installation)

This middleware can be installed with composer.

```
$ composer require los/los-cors
```

Usage
-----

[](#usage)

Include the `Los\Cors\CorsMiddleware` and it's factory `Los\Cors\CorsMiddlewareFactory` to your pipeline and use the configuration bellow.

```
/**
  * Set the list of allowed origins domain with protocol.
  * For example:
  * 'allowed_origins' => ['http://www.mysite.com','https://api.mysite.com'],
  */
'allowed_origins' => ['*'],

 /**
  * Set the list of HTTP verbs.
  */
'allowed_methods' => ['GET', 'OPTIONS'],

 /**
  * Set the list of allowed headers. This is returned in the preflight request to indicate
  * which HTTP headers can be used when making the actual request
  */
'allowed_headers' => ['Authorization', 'Accept', 'Content-Type'],

 /**
  * Set the max age of the preflight request in seconds. A non-zero max age means
  * that the preflight will be cached during this amount of time
  */
'max_age' => 120,

 /**
  * Set the list of exposed headers. This is a whitelist that authorize the browser
  * to access to some headers using the getResponseHeader() JavaScript method. Please
  * note that this feature is buggy and some browsers do not implement it correctly
  */
'expose_headers' => [],

 /**
  * Standard CORS requests do not send or set any cookies by default. For this to work,
  * the client must set the XMLHttpRequest's "withCredentials" property to "true". For
  * this to work, you must set this option to true so that the server can serve
  * the proper response header.
  */
'allowed_credentials' => false,
```

### Laminas / Mezzio

[](#laminas--mezzio)

If you are using [mezzio-skeleton](https://github.com/mezzio/mezzio-skeleton), you can copy `config/los-cors.global.php.dist` to `config/autoload/los-cors.global.php` and modify the configuration as needed.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance42

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~7 days

Total

2

Last Release

913d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9155a672b863ca2243f6b3d69d61d55bf35ae8e421c1b4f1655293a34d0451ba?d=identicon)[talbuquerque](/maintainers/talbuquerque)

---

Top Contributors

[![Lansoweb](https://avatars.githubusercontent.com/u/2109813?v=4)](https://github.com/Lansoweb "Lansoweb (3 commits)")[![talbuquerque](https://avatars.githubusercontent.com/u/20418669?v=4)](https://github.com/talbuquerque "talbuquerque (2 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zooxsmart-los-cors/health.svg)

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

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)[rareloop/lumberjack-core

A powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code

42155.0k19](/packages/rareloop-lumberjack-core)[laminas/laminas-psr7bridge

Bidirectional conversions between PSR-7 and laminas-http messages

117.9M18](/packages/laminas-laminas-psr7bridge)[openswoole/core

Openswoole core library

181.1M31](/packages/openswoole-core)

PHPackages © 2026

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