Download the PHP package easyshield/php-secure-headers without Composer
On this page you can find all versions of the php package easyshield/php-secure-headers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download easyshield/php-secure-headers
More information about easyshield/php-secure-headers
Files in easyshield/php-secure-headers
Download easyshield/php-secure-headers
More information about easyshield/php-secure-headers
Files in easyshield/php-secure-headers
Vendor easyshield
Package php-secure-headers
Short Description A simple yet powerful PHP library for managing security headers in web applications
License MIT
Homepage https://github.com/shadighorbani7171/php-secure-headers
Package php-secure-headers
Short Description A simple yet powerful PHP library for managing security headers in web applications
License MIT
Homepage https://github.com/shadighorbani7171/php-secure-headers
Please rate this library. Is it a good library?
Informations about the package php-secure-headers
PHP Secure Headers
فارسی
A powerful PHP library for managing security headers in web applications. This library helps you implement best security practices by easily configuring various security headers including Content Security Policy (CSP), HTTP Strict Transport Security (HSTS), and more.
## Features
- 🛡️ Easy configuration of security headers
- 🔒 Support for Content Security Policy (CSP)
- 🔐 HTTP Strict Transport Security (HSTS)
- 🚫 X-Frame-Options protection
- 🔍 X-Content-Type-Options
- 🛑 X-XSS-Protection
- 📝 Referrer Policy
- 🎯 Permissions Policy
- 📱 Client Hints Policy
- ⚙️ Two security levels: Basic and Strict
- 🔄 Automatic nonce generation for CSP
- ⚡ Framework integrations (Laravel & Symfony)
## Installation
You can install the package via composer:
## Quick Usage
### Method 1: Plain PHP
Just 5 lines of code to enable all security headers:
### Method 2: Laravel Integration
In Laravel, just add the middleware:
Then register it in `bootstrap/app.php`:
### Method 3: Symfony Integration
## Custom Configuration
Enable only specific headers:
### Custom CSP
#### Method 1: Using Array Configuration
#### Method 2: Using CSP Builder (Fluent API)
#### Advanced CSP Features
**Auto-detecting external resources from HTML:**
**Auto-injecting nonces into HTML:**
**Using hashes for inline scripts instead of nonces:**
### Custom HSTS
### Custom Permissions Policy
## Framework Integration
### Laravel
For detailed Laravel instructions, see [examples/Laravel/README.md](examples/Laravel/README.md).
> **Note**: When using the Laravel integration, please include the following attribution in your project's README:
>
> Laravel integration based on [PHP Secure Headers](https://github.com/shadighorbani7171/php-secure-headers) by [Shadi Ghorbani](https://github.com/shadighorbani7171).
### Symfony 7/8
For detailed Symfony instructions, see [examples/Symfony/README.md](examples/Symfony/README.md).
> **Note**: When using the Symfony integration, please include the following attribution in your project's README:
>
> Symfony integration based on [PHP Secure Headers](https://github.com/shadighorbani7171/php-secure-headers) by [Shadi Ghorbani](https://github.com/shadighorbani7171).
## Advanced Usage
### Client Hints Policy
### Critical Client Hints
## Security Levels
The library supports two security levels:
### Basic Level
* Allows 'unsafe-inline' for styles
* Less restrictive CSP
* Basic permissions policy
### Strict Level (Default)
* No 'unsafe-inline'
* Strict CSP with nonce
* Comprehensive permissions policy
* Enforces upgrade-insecure-requests
## More Examples
For more examples, please refer to the [comprehensive guide](GUIDE.md).
## Testing
## Code Quality
## Feedback and Contributions
Your feedback is highly appreciated! If you have any suggestions, ideas, or comments, please:
* Open an issue on GitHub
* Share how you're using the library
* Suggest improvements or new features
See [CONTRIBUTING.md](CONTRIBUTING.md) for more information on how to contribute.
## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
* [Shadi Ghorbani](https://github.com/shadighorbani7171)
* [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
# هدرهای امنیتی PHP
یک کتابخانه قدرتمند PHP برای مدیریت هدرهای امنیتی در برنامههای وب. این کتابخانه با پیکربندی آسان انواع هدرهای امنیتی از جمله Content Security Policy (CSP)، HTTP Strict Transport Security (HSTS) و موارد دیگر، به شما کمک میکند بهترین روشهای امنیتی را پیادهسازی کنید.
## ویژگیها
- 🛡️ پیکربندی آسان هدرهای امنیتی
- 🔒 پشتیبانی از سیاست امنیتی محتوا (CSP)
- 🔐 امنیت انتقال سختگیرانه HTTP (HSTS)
- 🚫 محافظت X-Frame-Options
- 🔍 X-Content-Type-Options
- 🛑 X-XSS-Protection
- 📝 سیاست ارجاع (Referrer Policy)
- 🎯 سیاست مجوزها (Permissions Policy)
- 📱 سیاست اطلاعات مشتری (Client Hints Policy)
- ⚙️ دو سطح امنیتی: پایه و سختگیرانه
- 🔄 تولید خودکار nonce برای CSP
- ⚡ ادغام با فریمورکها (Laravel و Symfony)
## نصب
میتوانید این پکیج را از طریق Composer نصب کنید:
## استفاده سریع
### روش 1: PHP ساده
تنها با 5 خط کد، تمام هدرهای امنیتی را فعال کنید:
### روش 2: ادغام با Laravel
در Laravel، کافی است میدلور را اضافه کنید:
سپس آن را در `bootstrap/app.php` ثبت کنید:
### روش 3: ادغام با Symfony
## پیکربندی سفارشی
فعالسازی فقط هدرهای خاص:
### CSP سفارشی
#### روش 1: استفاده از پیکربندی آرایهای
#### روش 2: استفاده از CSP Builder (API روان)
#### ویژگیهای پیشرفته CSP
**تشخیص خودکار منابع خارجی از HTML:**
**تزریق خودکار nonce به HTML:**
**استفاده از hash برای اسکریپتهای درونخطی به جای nonce:**
### HSTS سفارشی
### Custom Permissions Policy
## مستندات بیشتر
برای مثالهای بیشتر و راهنمای کامل، لطفاً به [راهنمای جامع](GUIDE.md) مراجعه کنید.
## مشارکت
نظرات شما بسیار ارزشمند است! اگر پیشنهاد، ایده یا نظری دارید، لطفاً:
* در GitHub یک issue باز کنید
* نحوه استفاده خود از کتابخانه را به اشتراک بگذارید
* بهبودها یا ویژگیهای جدید را پیشنهاد دهید
برای اطلاعات بیشتر در مورد نحوه مشارکت، به [CONTRIBUTING.md](CONTRIBUTING.md) مراجعه کنید.
## امنیت
اگر مشکلات مرتبط با امنیت پیدا کردید، لطفاً به جای استفاده از issue tracker، به آدرس [email protected] ایمیل بزنید.
## مجوز
مجوز MIT (MIT). لطفاً برای اطلاعات بیشتر به [فایل مجوز](LICENSE.md) مراجعه کنید.
All versions of php-secure-headers with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
The package easyshield/php-secure-headers contains the following files
Loading the files please wait ...