2017 © Pedro Peláez
 

library laravel-secureheaders

SecureHeaders wrapper for Laravel.

image

mikefrancis/laravel-secureheaders

SecureHeaders wrapper for Laravel.

  • Thursday, February 22, 2018
  • by mikefrancis
  • Repository
  • 4 Watchers
  • 35 Stars
  • 4,551 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 9 Versions
  • 40 % Grown

The README.md

Laravel SecureHeaders

Packagist Build Status codecov, (*1)

SecureHeaders wrapper for Laravel., (*2)

Based on aidantwoods/SecureHeaders., (*3)

Installation

Require the mikefrancis/laravel-secureheaders package in your composer.json and update your dependencies:, (*4)

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:, (*5)

MikeFrancis\LaravelSecureHeaders\ServiceProvider::class,

Usage

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

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

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:, (*7)

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

A typical configuration might look like this:, (*8)

<?php

return [
    // Safe Mode
    'safeMode' => false,

    // HSTS Strict-Transport-Security
    'hsts' => [
        'enabled' => true,
    ],

    // Content Security Policy
    'csp' => [
        'default' => [
            'self',
        ],
        'img-src' => [
            '*', // Allow images from anywhere
        ],
        'style-src' => [
            'self',
            'unsafe-inline', // Allow inline styles
            'https://fonts.googleapis.com', // Allow stylesheets from Google Fonts
        ],
        'font-src' => [
            'self',
            'https://fonts.gstatic.com', // Allow fonts from the Google Fonts CDN
        ],
    ],
];

For a full reference of Content Security Policy directives and their values, see content-security-policy.com., (*9)

The Versions

22/02 2018

dev-master

9999999-dev

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis

22/02 2018

v1.3

1.3.0.0

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis

20/01 2018

dev-feature/csp-nonce

dev-feature/csp-nonce

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis

09/01 2018

v1.2

1.2.0.0

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis

30/08 2017

v1.1

1.1.0.0

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis

01/08 2017

v1.0

1.0.0.0

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis

29/07 2017

v0.2

0.2.0.0

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis

21/07 2017

v0.1.1

0.1.1.0

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis

19/07 2017

v0.1.0

0.1.0.0

SecureHeaders wrapper for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Francis