PHPackages                             zrnik/php-slim-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. zrnik/php-slim-cors

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

zrnik/php-slim-cors
===================

Slim Framework 4 CORS

v0.1.0(2y ago)02.2kMITPHPPHP &gt;=8.1

Since Mar 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Zrnik/php-slim-cors)[ Packagist](https://packagist.org/packages/zrnik/php-slim-cors)[ RSS](/packages/zrnik-php-slim-cors/feed)WikiDiscussions master Synced 3w ago

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

Slim Framework 4 CORS Middleware
================================

[](#slim-framework-4-cors-middleware)

I just wanted to remove CORS error from my `React`application to my Slim Framework 4 API.

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

[](#installation)

```
composer require zrnik/php-slim-cors

```

Requires Slim Framework 4 &amp; PHP 8.1+

Usage
-----

[](#usage)

Add this middleware to your `\Slim\App`:

```
$app = new \Slim\App();
$app->add(new \Zrnik\SlimCors\CorsMiddleware());
```

That's it. There are optional parameters for the `CorsMiddleware` object:

```
$app = new \Slim\App();
$app->add(
    new \Zrnik\SlimCors\CorsMiddleware(
        allowedOrigins: [
            'my-frontend.app',
            'another-app.com',
        ],
        allowedMethods: [
            'GET', 'POST'
        ]
    )
);
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

Total

2

Last Release

819d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/55077930?v=4)[Štěpán Zrník](/maintainers/zrnik)[@Zrnik](https://github.com/Zrnik)

---

Top Contributors

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

---

Tags

corsmiddlewarephpphp8slim-frameworkslim4

### Embed Badge

![Health badge](/badges/zrnik-php-slim-cors/health.svg)

```
[![Health](https://phpackages.com/badges/zrnik-php-slim-cors/health.svg)](https://phpackages.com/packages/zrnik-php-slim-cors)
```

###  Alternatives

[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)[brandembassy/slim-nette-extension

19198.2k](/packages/brandembassy-slim-nette-extension)[maurobonfietti/slim4-api-skeleton

Useful skeleton for RESTful API development, using PHP and Slim 4.

1392.4k](/packages/maurobonfietti-slim4-api-skeleton)[duxweb/dux-lite

The lightweight framework based on slim php

161.0k9](/packages/duxweb-dux-lite)

PHPackages © 2026

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