Package Data | |
---|---|
Maintainer Username: | bepsvpt |
Maintainer Contact: | 6ibrl@cpp.tw (bepsvpt) |
Package Create Date: | 2015-12-01 |
Package Last Update: | 2024-10-14 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-14 15:01:19 |
Package Statistics | |
---|---|
Total Downloads: | 3,205,327 |
Monthly Downloads: | 79,614 |
Daily Downloads: | 1,515 |
Total Stars: | 509 |
Total Watchers: | 19 |
Total Forks: | 45 |
Total Open Issues: | 1 |
Add security related headers to HTTP response. The package includes Service Providers for easy Laravel integration.
5.3.3
5.1 ~ 5.8
Install using composer
composer require bepsvpt/secure-headers
Copy config file to your project directory
cp vendor/bepsvpt/secure-headers/config/secure-headers.php path/to/your/project/directory
Set up config file
Done!
Install using composer
composer require bepsvpt/secure-headers
Add service provider in config/app.php
( laravel version < 5.5 )
Bepsvpt\SecureHeaders\SecureHeadersServiceProvider::class,
Publish config file
php artisan vendor:publish --provider="Bepsvpt\SecureHeaders\SecureHeadersServiceProvider"
Add global middleware in app/Http/Kernel.php
\Bepsvpt\SecureHeaders\SecureHeadersMiddleware::class,
Set up config file config/secure-headers.php
Done!
Install using composer
composer require bepsvpt/secure-headers
Add service provider in bootstrap/app.php
$app->register(Bepsvpt\SecureHeaders\SecureHeadersServiceProvider::class);
Copy config file to project directory
mkdir config
cp vendor/bepsvpt/secure-headers/config/secure-headers.php config/secure-headers.php
Set up config file config/secure-headers.php
Done!
Do not forget to import namespace.
<?php
use \Bepsvpt\SecureHeaders\SecureHeaders;
<?php
// instantiate the class by fromFile static method
$secureHeaders = SecureHeaders::fromFile('/path/to/secure-headers.php');
// or instantiate the class directly
$config = require '/path/to/secure-headers.php';
$config['key'] = 'value'; // modify config value if you need
$secureHeaders = new SecureHeaders($config);
// Get headers
$secureHeaders->headers();
// Send headers to HTTP response
$secureHeaders->send();
Please see DOCS for details.
Please see CHANGELOG for details.
Please see UPGRADE for details.
Secure Headers is licensed under The MIT License (MIT).