Spatie's Laravel Content Security Policy (CSP) package provides easy CSP management for enhanced web security.
Current Version: 3.20.0
Last Updated: 2025-10-09
PHP Requirement: ^8.3
Dependencies: None
Package Description
Protect your Laravel application against various attacks with Laravel CSP by Spatie. Easily configure Content Security Policy for enhanced security and compliance. Implement strict directives to prevent XSS attacks and secure your web application effectively.
Make sure to include the correct namespace and class paths for proper usage.
<?php
// Example from PHPlibraries.com
require_once 'libs/spatie/laravel-csp/3.20.0/loader.php';
use Spatie\Csp\Directive;
use Spatie\Csp\CspMiddleware;
$obj = new Directive();
echo '✅ Test OK: ' . get_class($obj);
?>
We aim to make using PHP packages easier without Composer. If something doesn't work, let us know — we'll fix it promptly.
Community Discussion
Ask questions, share tips, or report issues below.