PHPackages                             componenta/http-cors-middleware - 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. componenta/http-cors-middleware

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

componenta/http-cors-middleware
===============================

CORS PSR-15 middleware for Componenta

v1.0.0(1mo ago)00MITPHPPHP ^8.4

Since Jun 16Pushed 1mo agoCompare

[ Source](https://github.com/componenta/http-cors-middleware)[ Packagist](https://packagist.org/packages/componenta/http-cors-middleware)[ RSS](/packages/componenta-http-cors-middleware/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Componenta HTTP CORS Middleware
===============================

[](#componenta-http-cors-middleware)

PSR-15 middleware for Cross-Origin Resource Sharing. It validates request origins, handles preflight `OPTIONS` requests, and adds CORS response headers.

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

[](#installation)

```
composer require componenta/http-cors-middleware
```

This package has no config provider. Create `CorsConfiguration` and `CorsMiddleware` explicitly in the application container or route middleware list.

Quick Start
-----------

[](#quick-start)

```
use Componenta\Http\Middleware\Cors\CorsConfiguration;
use Componenta\Http\Middleware\Cors\CorsMiddleware;

$middleware = new CorsMiddleware(
    config: new CorsConfiguration(
        allowedOrigins: ['https://example.com'],
        allowedMethods: ['GET', 'POST', 'OPTIONS'],
        allowedHeaders: ['Content-Type', 'Authorization'],
        allowCredentials: true,
    ),
    responseFactory: $responseFactory,
);
```

Configuration
-------------

[](#configuration)

`CorsConfiguration` accepts allowed origins, methods, request headers, exposed headers, optional `maxAge`, `allowCredentials`, and `allowPrivateNetwork`.

`CorsMiddleware` also requires a PSR-17 `ResponseFactoryInterface` to create preflight and rejection responses.

Wildcard origins and headers are supported. When credentials are enabled, wildcard handling follows browser CORS rules and specific values should be configured.

Boundary
--------

[](#boundary)

This package only handles CORS. Authentication, CSRF, trusted proxy handling, and rate limiting are separate middleware packages.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance91

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20490712?v=4)[Andrey Shelamkoff](/maintainers/Shelamkoff)[@Shelamkoff](https://github.com/Shelamkoff)

---

Top Contributors

[![Shelamkoff](https://avatars.githubusercontent.com/u/20490712?v=4)](https://github.com/Shelamkoff "Shelamkoff (1 commits)")

### Embed Badge

![Health badge](/badges/componenta-http-cors-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/componenta-http-cors-middleware/health.svg)](https://phpackages.com/packages/componenta-http-cors-middleware)
```

###  Alternatives

[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M126](/packages/mezzio-mezzio)[hyperf/hyperf

A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.

6.9k3.3k2](/packages/hyperf-hyperf)[sunrise/http-router

A powerful solution as the foundation of your project.

17451.8k11](/packages/sunrise-http-router)[mezzio/mezzio-authentication-oauth2

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

28591.3k3](/packages/mezzio-mezzio-authentication-oauth2)[mimmi20/browser-detector

Library to detect Browsers and Devices

48157.6k5](/packages/mimmi20-browser-detector)

PHPackages © 2026

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