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)443.5k↓62.9%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 2d 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

39

—

LowBetter than 84% of packages

Maintenance22

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity75

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

571d 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://avatars.githubusercontent.com/u/63869?v=4)[Kaz Watanabe](/maintainers/kaz29)[@kaz29](https://github.com/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

[cakephp/debug_kit

CakePHP Debug Kit

86314.7M171](/packages/cakephp-debug-kit)[cakephp/bake

Bake plugin for CakePHP

11212.0M202](/packages/cakephp-bake)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308954.9k25](/packages/dereuromark-cakephp-queue)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1882.3M44](/packages/dereuromark-cakephp-ide-helper)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

3361.0M51](/packages/dereuromark-cakephp-tools)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

131240.2k13](/packages/dereuromark-cakephp-tinyauth)

PHPackages © 2026

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