PHPackages                             assayer-pro/yii2-cspreport - 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. [Security](/categories/security)
4. /
5. assayer-pro/yii2-cspreport

ActiveYii2-extension[Security](/categories/security)

assayer-pro/yii2-cspreport
==========================

Yii2 Module for Content Security Policy Report

1.0.1(10y ago)24.6kMITPHP

Since Feb 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/assayer-pro/yii2-cspreport)[ Packagist](https://packagist.org/packages/assayer-pro/yii2-cspreport)[ Docs](https://github.com/assayer-pro/yii-cspreport)[ RSS](/packages/assayer-pro-yii2-cspreport/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

yii2-cspreport
==============

[](#yii2-cspreport)

yii2 Module for [Content Security Policy Report](http://content-security-policy.com/)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

- Either run

```
php composer.phar require --prefer-dist "assayer-pro/yii2-cspreport" "*"

```

or add

```
"assayer-pro/yii2-cspreport" : "*"
```

to the `require` section of your application's `composer.json` file.

Usage
-----

[](#usage)

- Add a new module in modules section of your application's configuration file, for example:

```
    'modules' => [
        'csp-report' => [
            'class' => 'assayerpro\cspreport\Module',
            'message' => [
                'from' => 'admin@example.com',
                'to' => 'developer@example.com',
                'subject' => 'Content Security Policy Report',
            ],
        ],
    ],
```

- Add a new rule for `urlManager` of your application's configuration file, for example:

```
    'components' => [
    ...
        'urlManager' => [
            'rules' => [
                'csp-report' => 'csp-report/report/index',
            ],
        ],
    ...
    ],
```

- Add application/csp-report parser:

```
    'components' => [
    ...
        'request' => [
            'parsers' => [
                'application/csp-report' => 'yii\web\JsonParser',
            ],
        ],
    ...
    ],
```

- Apache Content-Security-Policy Header

Add the following to your httpd.conf in your VirtualHost or in an .htaccess file:

```
Header set Content-Security-Policy-Report-Only "default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data:; font-src https: data:; report-uri /csp-report;"

```

- Nginx Content-Security-Policy Header

In your server {} block add:

```
   add_header Content-Security-Policy-Report-Only "default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data:; font-src https: data:; report-uri /csp-report";

```

You can also append always to the end to ensure that nginx sends the header reguardless of response code.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

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 ~0 days

Total

2

Last Release

3783d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11675777?v=4)[Assayer Pro](/maintainers/assayer-pro)[@assayer-pro](https://github.com/assayer-pro)

---

Top Contributors

[![serge-larin](https://avatars.githubusercontent.com/u/6086715?v=4)](https://github.com/serge-larin "serge-larin (10 commits)")

### Embed Badge

![Health badge](/badges/assayer-pro-yii2-cspreport/health.svg)

```
[![Health](https://phpackages.com/badges/assayer-pro-yii2-cspreport/health.svg)](https://phpackages.com/packages/assayer-pro-yii2-cspreport)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)

PHPackages © 2026

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