PHPackages                             phalapi/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phalapi/cors

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phalapi/cors
============

PhalApi 2.x 扩展类库 - 跨域

5927↓83.3%2[2 issues](https://github.com/gongshunkai/phalapi-cors/issues)PHP

Since Nov 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/gongshunkai/phalapi-cors)[ Packagist](https://packagist.org/packages/phalapi/cors)[ RSS](/packages/phalapi-cors/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

CORS跨域扩展
========

[](#cors跨域扩展)

安装和配置
-----

[](#安装和配置)

修改项目下的composer.json文件，并添加：

```
    "phalapi/cors":"dev-master"

```

在/path/to/phalapi/config/app.php文件中，配置：

```
    'cors' => array(
        //域名白名单
        'whitelist'   => array(
            //'http://xxx.xx.xxx',
            //'http://xxx.xxx.xxx'
        ),
        //header头
        'headers' => array(
            'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS', //支持的请求类型
            'Access-Control-Allow-Credentials' => 'true' //支持cookie
        )
    )

```

然后执行`composer update`。

注册
--

[](#注册)

在/path/to/phalapi/config/di.php文件中，注册：

```
$di->cors = new \PhalApi\CORS\Lite();
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/35d70b1236f8f67d96ba3da4ba88889faf2837ff8f7ab62acc54fe6cb4992c87?d=identicon)[dogstarhuang](/maintainers/dogstarhuang)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[laravel-admin-ext/sparkline

Integrates jQuery sparkline into laravel-admin

161.1k](/packages/laravel-admin-ext-sparkline)

PHPackages © 2026

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