mikefrancis/laravel-secureheaders
Composer 安装命令:
composer require mikefrancis/laravel-secureheaders
包简介
SecureHeaders wrapper for Laravel.
README 文档
README
SecureHeaders wrapper for Laravel.
Based on aidantwoods/SecureHeaders.
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
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
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:
<?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.
mikefrancis/laravel-secureheaders 适用场景与选型建议
mikefrancis/laravel-secureheaders 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 539.91k 次下载、GitHub Stars 达 97, 最近一次更新时间为 2017 年 07 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mikefrancis/laravel-secureheaders 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mikefrancis/laravel-secureheaders 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 539.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 97
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-17