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

ActiveLibrary

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

Slim Framework 4 CORS

v0.1.0(2y ago)02.0k↓100%MITPHPPHP &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 1mo 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

26

—

LowBetter than 43% of packages

Maintenance26

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

774d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ef2b2321754ec75f086e19c9d2ad58a349217a4fe0a2b8944299173081167dd?d=identicon)[zrnik](/maintainers/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

[slim/slim-skeleton

A Slim Framework skeleton application for rapid development

1.6k458.7k6](/packages/slim-slim-skeleton)[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)[docler-labs/codeception-slim-module

Codeception Module for Slim framework.

13178.0k1](/packages/docler-labs-codeception-slim-module)[oat-sa/tao-core

TAO core extension

66136.7k74](/packages/oat-sa-tao-core)[brandembassy/slim-nette-extension

19190.2k](/packages/brandembassy-slim-nette-extension)[vesp/core

Vesp core library to make backend simple

243.8k5](/packages/vesp-core)

PHPackages © 2026

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