PHPackages                             ssx/csp-parser - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. ssx/csp-parser

ActiveLibrary[HTTP &amp; Networking](/categories/http)

ssx/csp-parser
==============

0.0.1(1y ago)09MITPHP

Since Mar 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ssx/csp-parser)[ Packagist](https://packagist.org/packages/ssx/csp-parser)[ RSS](/packages/ssx-csp-parser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

CSP Parser
==========

[](#csp-parser)

This package contains a PHP class that will help you fetch and parse CSP headers from a website.

```
require 'vendor/autoload.php';

$csp = new \Ssx\Csp\Parser('https://www.mywebsite.com/');
var_dump($csp->getDirectives());
```

You can use either `getDirectives()` to return an array of all the processed CSP directives or you can use `getDirective('script-src')` to get a particular type of directive.

Each directive will contain either an array of results or an empty array for a directive such as `upgrade-insecure-requests`:

```
  "upgrade-insecure-requests" => []
  "font-src" => array:19 [
    0 => "fonts.gstatic.com"
    1 => "use.typekit.net"
    2 => "*.typekit.net"
    3 => "*.gstatic.com"
    4 => "*.hotjar.com"
    5 => "*.tidiochat.com"
    6 => "*.cookiebot.com"
    7 => "*.pcapredict.com"
    8 => "*.postcodeanywhere.co.uk"
    9 => "maxcdn.bootstrapcdn.com"
    10 => "*.stripe.com"
    11 => "klarna.com"
    12 => "*.klarna.com"
    13 => "*.klarnacdn.net"
    14 => "*.klarnaevt.com"
    15 => "*.superpayments.com"
    16 => "data:"
    17 => "'self'"
    18 => "'unsafe-inline'"
  ]

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance46

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

417d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/254889?v=4)[Scott](/maintainers/ssx)[@ssx](https://github.com/ssx)

---

Top Contributors

[![ssx](https://avatars.githubusercontent.com/u/254889?v=4)](https://github.com/ssx "ssx (3 commits)")

---

Tags

httpparsersecurityheaderscspcontent-security-policypci

### Embed Badge

![Health badge](/badges/ssx-csp-parser/health.svg)

```
[![Health](https://phpackages.com/badges/ssx-csp-parser/health.svg)](https://phpackages.com/packages/ssx-csp-parser)
```

###  Alternatives

[paragonie/csp-builder

Easily add and update Content-Security-Policy headers for your project

5412.8M18](/packages/paragonie-csp-builder)[spatie/laravel-csp

Add CSP headers to the responses of a Laravel app

8569.6M19](/packages/spatie-laravel-csp)[middlewares/csp

Middleware to add the Content-Security-Policy header to the response

1720.6k](/packages/middlewares-csp)[bakame/http-structured-fields

A PHP library that parses, validates and serializes HTTP structured fields according to RFC9561 and RFC8941

442.6k4](/packages/bakame-http-structured-fields)[middlewares/firewall

Middleware to provide IP filtering

12318.3k2](/packages/middlewares-firewall)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
