PHPackages                             havenshen/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. [Framework](/categories/framework)
4. /
5. havenshen/slim-cors

ActiveLibrary[Framework](/categories/framework)

havenshen/slim-cors
===================

Slim Framework 3 CORS middleware

v1.0.0(9y ago)4256MITPHP

Since Mar 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/HavenShen/Slim-Cors)[ Packagist](https://packagist.org/packages/havenshen/slim-cors)[ RSS](/packages/havenshen-slim-cors/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Slim Framework CORS Protection
==============================

[](#slim-framework-cors-protection)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4ede9416f8c7076e266a29a878ccd4407ffb96f95673a7c21181d39a6fcc9220/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f486176656e5368656e2f536c696d2d436f72732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/?branch=master)[![Build Status](https://camo.githubusercontent.com/eebf673cda56fdd8fa6e2f973a8ddb97aa771bb7b2df180ae4eb0b70402fb6ba/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f486176656e5368656e2f536c696d2d436f72732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/fa6683908291f7220455af26d17e094b3cce5c8d05d1702279eeac4e3ddd9fa0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f486176656e5368656e2f536c696d2d436f72732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/HavenShen/Slim-Cors/?branch=master)[![Build Status](https://camo.githubusercontent.com/24f4e1d7951bec604c3903c71662931ca4c27e8ef02b1c7f588d1eb686d722f0/68747470733a2f2f7472617669732d63692e6f72672f486176656e5368656e2f536c696d2d436f72732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/HavenShen/Slim-Cors)[![Latest Stable Version](https://camo.githubusercontent.com/9433352af82a20526465e7886480536d731ea0898c0829adcba41d397df6baf5/68747470733a2f2f706f7365722e707567782e6f72672f486176656e5368656e2f536c696d2d436f72732f762f737461626c652e737667)](https://packagist.org/packages/HavenShen/Slim-Cors)[![Latest Unstable Version](https://camo.githubusercontent.com/70ef3e6a0a545144c96e1d0b549967d3ece0d6b9f175ee71c59dd3f86b06e91f/68747470733a2f2f706f7365722e707567782e6f72672f486176656e5368656e2f536c696d2d436f72732f762f756e737461626c652e737667)](https://packagist.org/packages/HavenShen/Slim-Cors)[![Latest Stable Version](https://camo.githubusercontent.com/3c2866179f7078cf31d8f798ae762097755a4ee687b185b7a1305152b802232c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f486176656e5368656e2f536c696d2d436f72732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/HavenShen/Slim-Cors)[![Total Downloads](https://camo.githubusercontent.com/27c592dd7972a60f425ecd8a39fe87a339628bb1ec12575a3bd83f5e3a39a007/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f486176656e5368656e2f536c696d2d436f72732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/HavenShen/Slim-Cors)[![License](https://camo.githubusercontent.com/a25374631b396ce9856c0d46fb3fcc409a22396529512dba3a0e5df9b7a796f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f486176656e5368656e2f536c696d2d436f72732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/HavenShen/Slim-Cors)

This repository contains a Slim Framework CORS middleware.

Install
-------

[](#install)

Via Composer

```
$ composer require havenshen/slim-cors
```

Requires Slim 3.0.0 or newer.

Usage
-----

[](#usage)

In most cases you want to register HavenShen\\Slim\\Cors.

### Register

[](#register)

```
$app = new \Slim\App([
    'settings' => [
        'dispayErrorDetails' => true,
    ]
]);

$container = $app->getContainer();

$container['cors'] = function ($c) {
    return new \HavenShen\Slim\Cors\Guard;
};

$app->add($container->get('cors'));
```

Testing
-------

[](#testing)

```
$ phpunit
```

Development progress
--------------------

[](#development-progress)

continues to update...

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

3385d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

corsframeworkmiddlewareslimmiddlewareframeworkcorsslim

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[slim/csrf

Slim Framework 4 CSRF protection PSR-15 middleware

3512.1M100](/packages/slim-csrf)[slim/http-cache

Slim Framework HTTP cache middleware and service provider

1163.1M32](/packages/slim-http-cache)[davidepastore/slim-validation

A slim middleware for validation based on Respect/Validation

170227.3k3](/packages/davidepastore-slim-validation)[pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

3693.1k3](/packages/pavlakis-slim-cli)[davidepastore/slim-restrict-route

A Slim middleware to restrict ip addresses that will access to your routes

2220.9k1](/packages/davidepastore-slim-restrict-route)[davidepastore/slim-config

A slim middleware to read configuration from different files based on hassankhan/config

339.0k1](/packages/davidepastore-slim-config)

PHPackages © 2026

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