PHPackages                             davidecesarano/embryo-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. davidecesarano/embryo-cors

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

davidecesarano/embryo-cors
==========================

PSR-15 to implement Cross-Origin Resource Sharing (CORS).

1.0.1(4y ago)0381MITPHPPHP &gt;=7.1

Since Jun 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/davidecesarano/Embryo-CORS)[ Packagist](https://packagist.org/packages/davidecesarano/embryo-cors)[ Docs](https://github.com/davidecesarano/embryo-cors)[ RSS](/packages/davidecesarano-embryo-cors/feed)WikiDiscussions master Synced 1mo ago

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

Embryo CORS
===========

[](#embryo-cors)

Simple PSR-15 Middleware to implement Cross-Origin Resource Sharing (CORS).

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1
- A [PSR-7](https://www.php-fig.org/psr/psr-7/) http message implementation and [PSR-17](https://www.php-fig.org/psr/psr-17/) http factory implementation (ex. [Embryo-Http](https://github.com/davidecesarano/Embryo-Http))
- A [PSR-15](https://www.php-fig.org/psr/psr-15/) http server request handlers implementation (ex. [Embryo-Middleware](https://github.com/davidecesarano/Embryo-Middleware))

Install
-------

[](#install)

Using Composer:

```
$ composer require davidecesarano/embryo-cors

```

Usage
-----

[](#usage)

```
use Embryo\CORS\CorsMiddleware;
use Embryo\Http\Factory\{ResponseFactory, ServerRequestFactory};
use Embryo\Http\Server\RequestHandler;

// Set options
$allowed_origins = ['*'];
$allowed_methods = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'];
$allowed_headers = ['Content-Type', 'Accept', 'Origin', 'Authorization'];
$exposed_headers = [];
$max_age = 0;
$supports_credentials = false;

// Add middleware to dispatcher
$requestHandler = new RequestHandler([
    (new CorsMiddleware)
        ->setAllowedOrigins($allowed_origins)
        ->setAllowedMethods($allowed_methods)
        ->setAllowedHeaders($allowed_headers)
        ->setExposedHeaders($exposed_headers)
        ->setMaxAge($max_age)
        ->setSupportsCredentials($supports_credentials)
]);

// Set PSR Request and Response
$request = (new ServerRequestFactory)->createServerRequestFromServer();
$response = (new ResponseFactory)->createResponse(200);

$response = $requestHandler->dispatch($request, $response);
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

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

1795d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16277144?v=4)[Davide Cesarano](/maintainers/davidecesarano)[@davidecesarano](https://github.com/davidecesarano)

---

Top Contributors

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

---

Tags

corsmiddlewarephppsr-15phpcorspsr-15

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/davidecesarano-embryo-cors/health.svg)

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

###  Alternatives

[tuupola/cors-middleware

PSR-7 and PSR-15 CORS middleware

1331.8M24](/packages/tuupola-cors-middleware)[mezzio/mezzio-cors

CORS component for Mezzio and other PSR-15 middleware runners.

17568.5k5](/packages/mezzio-mezzio-cors)[middlewares/cors

Middleware to implement Cross-Origin Resource Sharing (CORS)

1372.2k3](/packages/middlewares-cors)[httpsoft/http-basis

Simple and fast HTTP microframework implementing PSR standards

1334.9k1](/packages/httpsoft-http-basis)[divineniiquaye/flight-routing

Flight routing is a simple, fast PHP router that is easy to get integrated with other routers.

152.5k](/packages/divineniiquaye-flight-routing)

PHPackages © 2026

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