PHPackages                             therobfonz/laravel-security-headers - 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. therobfonz/laravel-security-headers

ActiveLibrary[Security](/categories/security)

therobfonz/laravel-security-headers
===================================

Adds security headers to Laravel responses.

3.1.0(6y ago)587.0k↓27.8%6[1 PRs](https://github.com/therobfonz/laravel-security-headers/pulls)mitPHPPHP ^8.1

Since Oct 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/therobfonz/laravel-security-headers)[ Packagist](https://packagist.org/packages/therobfonz/laravel-security-headers)[ RSS](/packages/therobfonz-laravel-security-headers/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (17)Used By (0)

Laravel Security Headers
========================

[](#laravel-security-headers)

This is a [Laravel](http://laravel.com/) service provider for adding security header responses to your application.

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

[](#installation)

The SecurityHeaders Service Provider can be installed via [Composer](http://getcomposer.org) by requiring the `therobfonz/laravel-security-headers` package in your project's `composer.json`.

```
{
    "require": {
        "therobfonz/laravel-security-headers": "^3.0"
    }
}
```

Packages are auto-discovered in Laravel 5.6+. Service Providers and Facades are defined in **composer.json**.

Config File
-----------

[](#config-file)

Publish the confirguration file using Artisan.

```
php artisan vendor:publish --provider="TheRobFonz\SecurityHeaders\Providers\SecurityHeadersServiceProvider"
```

Update your settings in the generated `config/security.php` configuration file.

Configuration
-------------

[](#configuration)

Add the middleware to the 'web' middleware group in `App\Http\Kernel.php`

```
protected $middlewareGroups = [
    'web' => [
        //...
        \TheRobFonz\SecurityHeaders\Middleware\RespondWithSecurityHeaders::class,
```

### Nonces

[](#nonces)

Every inline script tag needs to include the `@nonce` blade directive in the opening tag.

```

```

Links
-----

[](#links)

- [Laravel website](http://laravel.com/)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community10

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

Total

14

Last Release

2412d ago

Major Versions

2.0.0 → 3.0.02019-10-11

PHP version history (3 changes)2.0.0PHP ^8.1

v1.0.0PHP ^7.1.3

v1.0.11PHP &gt;=7.1.0 || &gt;=7.2.5

### Community

Maintainers

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

---

Top Contributors

[![therobfonz](https://avatars.githubusercontent.com/u/35386780?v=4)](https://github.com/therobfonz "therobfonz (11 commits)")

---

Tags

laravelsecurity-headers

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/therobfonz-laravel-security-headers/health.svg)

```
[![Health](https://phpackages.com/badges/therobfonz-laravel-security-headers/health.svg)](https://phpackages.com/packages/therobfonz-laravel-security-headers)
```

###  Alternatives

[tzsk/otp

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

241641.4k1](/packages/tzsk-otp)[msurguy/honeypot

Honeypot spam prevention

4381.2M12](/packages/msurguy-honeypot)[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)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

642.6k](/packages/ercsctt-laravel-file-encryption)[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)
