PHPackages                             kaz29/cakephp-cors-middleware-plugin - 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. kaz29/cakephp-cors-middleware-plugin

ActiveCakephp-plugin[HTTP &amp; Networking](/categories/http)

kaz29/cakephp-cors-middleware-plugin
====================================

CorsMiddleware plugin for CakePHP

1.2.0(1y ago)437.4k↓34.7%1[3 issues](https://github.com/kaz29/cakephp-cors-middleware-plugin/issues)MITPHPPHP &gt;=8.4

Since Mar 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kaz29/cakephp-cors-middleware-plugin)[ Packagist](https://packagist.org/packages/kaz29/cakephp-cors-middleware-plugin)[ RSS](/packages/kaz29-cakephp-cors-middleware-plugin/feed)WikiDiscussions master Synced 1mo ago

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

CorsMiddleware plugin for CakePHP
=================================

[](#corsmiddleware-plugin-for-cakephp)

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).

The recommended way to install composer packages is:

```
composer require kaz29/cakephp-cors-middleware-plugin

```

Minimum setup
-------------

[](#minimum-setup)

- Add the following configuration into config/app\_local.php.

```
    'App' => [
        'cors' => [
            'allowUrls' => [
                'https://example.com', // your web site urls
                'https://app.example.com',
            ],
        ],
    ],

```

OR

When injecting with environment variables, it looks like this...

```
    'App' => [
        'cors' => [
            'allowUrls' => explode(',', env('CORS_ALLOW_URL', ''))
        ],
    ],

```

- Add load middleware setting into Application::middleware method.

```
    public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
    {
        $middlewareQueue
            ->add(new CorsMiddleware(Configure::read('App.cors')))  // Add this line
            // Catch any exceptions in the lower layers,
            // and make an error page/response
            ->add(new ErrorHandlerMiddleware(Configure::read('Error')))

```

Customize settings
------------------

[](#customize-settings)

```
    'App' => [
        'cors' => [
            'allowUrls' => [
                'https://example.com', // your web site urls
                'https://app.example.com',
                '/^http:\/\/localhost:(\d+)$/', // regular expression support
            ],
            'allowMethods' => [
                'GET',
                'POST',
                'HEAD',
                'OPTIONS',
                'PUT',
                'DELETE',
            ],
            'allowHeaders' => [
                'Accept-Language',
                'content-type',
                'Accept',
                'Origin',
                'Cookie',
                'Content-Length',
                'Authorization',
            ],
            'exposeHeaders' => [],
        ],
    ],

```

Author
------

[](#author)

Kazuhiro Watanabe - cyo \[at\] mac.com - [https://twitter.com/kaz\_29](https://twitter.com/kaz_29)

License
-------

[](#license)

CorsMiddleware plugin for CakePHP is licensed under the MIT License - see the LICENSE file for details

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance24

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity74

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

Every ~274 days

Recently: every ~290 days

Total

6

Last Release

525d ago

PHP version history (3 changes)1.0.0PHP &gt;=7.2

1.1.0PHP &gt;=8.1

1.2.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/44de8529c667030c187b91e31c795189fa17a4918de89c497053057973a56704?d=identicon)[kaz29](/maintainers/kaz29)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kaz29-cakephp-cors-middleware-plugin/health.svg)

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

###  Alternatives

[muffin/throttle

(API) Rate limiting requests in CakePHP

62286.8k](/packages/muffin-throttle)[mixerapi/mixerapi

Streamline development of API-first applications in CakePHP

4441.8k](/packages/mixerapi-mixerapi)[cakedc/cakephp-api

Api plugin for CakePHP

61100.6k](/packages/cakedc-cakephp-api)[andrej-griniuk/cakephp-fractal-transformer-view

CakePHP view builder utilizing Fractal library for entities transformation

1890.7k](/packages/andrej-griniuk-cakephp-fractal-transformer-view)[sprintcube/cakephp-rest

Rest API plugin for CakePHP 3

256.6k](/packages/sprintcube-cakephp-rest)

PHPackages © 2026

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