PHPackages                             mikefrancis/laravel-secureheaders - 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. [API Development](/categories/api)
4. /
5. mikefrancis/laravel-secureheaders

ActiveLibrary[API Development](/categories/api)

mikefrancis/laravel-secureheaders
=================================

SecureHeaders wrapper for Laravel.

v1.4.2(5y ago)97510.4k↓35.9%5[2 issues](https://github.com/mikefrancis/laravel-secureheaders/issues)MITPHP

Since Jul 19Pushed 4y ago3 watchersCompare

[ Source](https://github.com/mikefrancis/laravel-secureheaders)[ Packagist](https://packagist.org/packages/mikefrancis/laravel-secureheaders)[ RSS](/packages/mikefrancis-laravel-secureheaders/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (11)Used By (0)

Laravel SecureHeaders
=====================

[](#laravel-secureheaders)

[![Packagist](https://camo.githubusercontent.com/138fc81e13ca981de64e0a1c1492546538cacc3352b5122ae141b1b7def045f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696b656672616e6369732f6c61726176656c2d736563757265686561646572732e737667)](https://packagist.org/packages/mikefrancis/laravel-secureheaders) [![Build Status](https://camo.githubusercontent.com/99c3440021647abadd1c7e1e14fb22d6f8997b757792038ab6b6e432a4e8838e/68747470733a2f2f7472617669732d63692e6f72672f6d696b656672616e6369732f6c61726176656c2d736563757265686561646572732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mikefrancis/laravel-secureheaders) [![codecov](https://camo.githubusercontent.com/28848e10d49e319a141bc73dea4ab3e84fb2cb49b72037aebda6fda2043761a9/68747470733a2f2f636f6465636f762e696f2f67682f6d696b656672616e6369732f6c61726176656c2d736563757265686561646572732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/mikefrancis/laravel-secureheaders)

SecureHeaders wrapper for Laravel.

Based on [aidantwoods/SecureHeaders](https://github.com/aidantwoods/SecureHeaders).

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

[](#installation)

Require the `mikefrancis/laravel-secureheaders` package in your `composer.json` and update your dependencies:

```
composer require mikefrancis/laravel-secureheaders
```

If you are using Laravel 5.5+, package discovery is enabled. For Laravel 5.4, add the service provider to your `config/app.php` providers array:

```
MikeFrancis\LaravelSecureHeaders\ServiceProvider::class,
```

Usage
-----

[](#usage)

To add more secure headers to your entire application, add the `ApplySecureHeaders` middleware in the `$middleware`property of `app/Http/Kernel.php` class:

```
protected $middleware = [
    // ...
    \MikeFrancis\LaravelSecureHeaders\ApplySecureHeaders::class,
];
```

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

[](#configuration)

Some sensible defaults have been set in `config/secure-headers.php` but if you'd like to change these, copy the file to your own application's config using the following command:

```
php artisan vendor:publish --provider="MikeFrancis\LaravelSecureHeaders\ServiceProvider"
```

A typical configuration might look like this:

```
