PHPackages                             easyshield/php-secure-headers - 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. [Security](/categories/security)
4. /
5. easyshield/php-secure-headers

ActiveLibrary[Security](/categories/security)

easyshield/php-secure-headers
=============================

A simple yet powerful PHP library for managing security headers in web applications

1.0.1(1y ago)209↓66.7%3MITHTMLPHP ^8.1

Since Mar 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/shadighorbani7171/php-secure-headers)[ Packagist](https://packagist.org/packages/easyshield/php-secure-headers)[ Docs](https://github.com/shadighorbani7171/php-secure-headers)[ RSS](/packages/easyshield-php-secure-headers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

PHP Secure Headers
==================

[](#php-secure-headers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7246beb0c9f5f94ed8fd17e289505624d6b3c8f61b8c727eee9ffe84f5307a59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65617379736869656c642f7068702d7365637572652d686561646572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/easyshield/php-secure-headers)[![Tests](https://github.com/shadighorbani7171/php-secure-headers/actions/workflows/tests.yml/badge.svg)](https://github.com/shadighorbani7171/php-secure-headers/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/50bf90e0a2c0177521419278fba169567c26538570a72af45e2aabed4f7832db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65617379736869656c642f7068702d7365637572652d686561646572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/easyshield/php-secure-headers)

[English](#english) | [فارسی](#persian)

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
--------

[](#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 &amp; Symfony)

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

[](#installation)

You can install the package via composer:

```
composer require easyshield/php-secure-headers
```

Quick Usage
-----------

[](#quick-usage)

### Method 1: Plain PHP

[](#method-1-plain-php)

Just 5 lines of code to enable all security headers:

```
