Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Security Laravel Package

artisanpack-ui/security

Core Laravel security toolkit for ArtisanPack UI: sanitization, escaping (Laminas Escaper), KSES filtering, validation rules, security/CSP middleware, CSP builder with nonce & reporting, rate limiting, audit/scan commands, and testing helpers.

View on GitHub
Deep Wiki
Context7

title: Installation

Installation

Install via Composer

composer require artisanpack-ui/security

The package auto-registers via Laravel's package discovery.

Publish the config

php artisan vendor:publish --tag=security-config

Publishes config/artisanpack/security.php. Override headers, rate limiting, XSS protection, API security, CSP, testing, logging, and command defaults here.

Run migrations

php artisan migrate

Adds the csp_violation_reports table used by the CSP violation reporting endpoint.

Apply middleware

The package's middleware are aliased by the service provider but not applied globally — you opt in per route or in your app/Http/Kernel.php middleware groups:

// app/Http/Kernel.php (Laravel 10)
protected $middlewareGroups = [
    'web' => [
        // ...
        \ArtisanPackUI\Security\Http\Middleware\SecurityHeadersMiddleware::class,
        \ArtisanPackUI\Security\Http\Middleware\ContentSecurityPolicy::class,
    ],
];

Or in bootstrap/app.php (Laravel 11+):

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \ArtisanPackUI\Security\Http\Middleware\SecurityHeadersMiddleware::class,
        \ArtisanPackUI\Security\Http\Middleware\ContentSecurityPolicy::class,
    ]);
})

The shipped middleware aliases (csp, security.headers, xss.protection, api.security, api.rate_limit) work in route definitions:

Route::middleware(['csp', 'security.headers'])->group(function () {
    // ...
});

Deeper topics

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor