PHPackages                             paramonovav/laravel4-header-csp - 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. paramonovav/laravel4-header-csp

ActiveLibrary[Security](/categories/security)

paramonovav/laravel4-header-csp
===============================

Provides support for enforcing Content Security Policy with headers in Laravel 4 responses.

1.0.0(10y ago)4731MITPHPPHP &gt;=5.4.0

Since Aug 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/paramonovav/laravel4-header-csp)[ Packagist](https://packagist.org/packages/paramonovav/laravel4-header-csp)[ Docs](https://github.com/paramonovav/laravel4-header-csp)[ RSS](/packages/paramonovav-laravel4-header-csp/feed)WikiDiscussions master Synced 1mo ago

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

Response header Content Security Policy for Laravel 4
=====================================================

[](#response-header-content-security-policy-for-laravel-4)

[![Latest Stable Version](https://camo.githubusercontent.com/5ec70a6d9916d745001a5a7ac0004ec2d4556d08c9b20e49935a75e74a3ddd03/68747470733a2f2f706f7365722e707567782e6f72672f706172616d6f6e6f7661762f6c61726176656c342d6865616465722d6373702f762f737461626c65)](https://packagist.org/packages/paramonovav/laravel4-header-csp) [![Total Downloads](https://camo.githubusercontent.com/7b445322f2561c4276ad4352c724b3cccec007accc296bac84a1d1a69b3d9c99/68747470733a2f2f706f7365722e707567782e6f72672f706172616d6f6e6f7661762f6c61726176656c342d6865616465722d6373702f646f776e6c6f616473)](https://packagist.org/packages/paramonovav/laravel4-header-csp) [![Latest Unstable Version](https://camo.githubusercontent.com/43164f8de4aa67da094a26fa5f2a2f1424d81e476995e927ac21d04b95dbffee/68747470733a2f2f706f7365722e707567782e6f72672f706172616d6f6e6f7661762f6c61726176656c342d6865616465722d6373702f762f756e737461626c65)](https://packagist.org/packages/paramonovav/laravel4-header-csp) [![License](https://camo.githubusercontent.com/9a8b008b0079cbee92b6af13369d92f8974971b2beb92fd21c20ccb264733472/68747470733a2f2f706f7365722e707567782e6f72672f706172616d6f6e6f7661762f6c61726176656c342d6865616465722d6373702f6c6963656e7365)](https://packagist.org/packages/paramonovav/laravel4-header-csp)

Provides support for enforcing Content Security Policy and XSS Protection with headers in Laravel 4 responses.

*Note*: Based on [Content Security Policy](http://content-security-policy.com/), [Improving Web Security with the Content Security Policy](http://www.sitepoint.com/improving-web-security-with-the-content-security-policy/), [HTTP headers](https://www.owasp.org/index.php/List_of_useful_HTTP_headers).

Key Features
------------

[](#key-features)

1. Add rules for Content Security Policy (content-security-policy, x-content-security-policy, x-webkit-csp)
2. Save reports of policy failures to `storage/logs/content-security-policy-report` folder if needed
3. Add additional header like: `x-xss-protection, x-frame-options, x-content-type-options`

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

[](#installation)

Require this package with composer:

```
composer require paramonovav/laravel4-header-csp

```

After updating composer, add the ServiceProvider to the providers array in app/config/app.php

```
'Paramonovav\Laravel4HeaderCsp\Laravel4HeaderCspServiceProvider',

```

You need to publish the config from this package.

```
php artisan config:publish paramonovav/laravel4-header-csp

```

Usage
-----

[](#usage)

### Apply content security policy to routes

[](#apply-content-security-policy-to-routes)

The following will apply all default profiles to the `login` route.

```
Route::get('login', array('after'=>'response.secure'), function()
{
    return 'Hello, on login page !';
}));

```

The following will apply all default profiles and a specific `google` profile to the `login` route.

```
Route::get('login', array('after'=>'response.secure:google'), function()
{
    return 'Hello, on login page !';
}));

```

You can include any number of specific profiles. The following will apply default, google, flickr, and my\_custom profiles to the `login` route.

```
Route::get('login', array('after'=>'response.secure:google-flickr-my_custom'), function()
{
    return 'Hello, on login page !';
}));

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

3931d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc3728c3aac76a080a0c92ced2910fb710b97cda3e2d3363942cc769f1c4d4c8?d=identicon)[paramonovav](/maintainers/paramonovav)

---

Top Contributors

[![paramonovav](https://avatars.githubusercontent.com/u/607431?v=4)](https://github.com/paramonovav "paramonovav (6 commits)")

---

Tags

cspheaderlaravellaravel4responselaravelheadercspcontent-security-policyLaravel 4xss-protection

### Embed Badge

![Health badge](/badges/paramonovav-laravel4-header-csp/health.svg)

```
[![Health](https://phpackages.com/badges/paramonovav-laravel4-header-csp/health.svg)](https://phpackages.com/packages/paramonovav-laravel4-header-csp)
```

###  Alternatives

[spatie/laravel-csp

Add CSP headers to the responses of a Laravel app

8519.6M19](/packages/spatie-laravel-csp)[bepsvpt/secure-headers

Add security related headers to HTTP response. The package includes Service Providers for easy Laravel integration.

5484.7M9](/packages/bepsvpt-secure-headers)[tzsk/otp

A secure, database-free One-Time Password (OTP) generator and verifier for PHP and Laravel.

241641.4k1](/packages/tzsk-otp)[dgtlss/warden

A Laravel package that proactively monitors your dependencies for security vulnerabilities by running automated composer audits and sending notifications via webhooks and email

8745.6k](/packages/dgtlss-warden)[stevenmaguire/laravel-middleware-csp

Provides support for enforcing Content Security Policy with headers in Laravel responses.

39107.6k](/packages/stevenmaguire-laravel-middleware-csp)[laragear/poke

Keep your forms alive, avoid TokenMismatchException by gently poking your Laravel app

2211.5k](/packages/laragear-poke)

PHPackages © 2026

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