spatie/laravel-cookie-consent
Add a simple, customizable cookie consent banner to Laravel. Shows on first visit, stores consent, then stays hidden. No “decline” option, no tracker blocking, and no consent categories—use other tools if you need advanced compliance features.
.env and published config files, enabling environment-specific customization.composer require) with auto-registration.@include('cookie-consent::index')) for explicit control.CookieConsentMiddleware) for global enforcement (Laravel 9–13 compatible).marcogermani87/filament-cookie-consent).whitecube/laravel-cookie-consent) may be needed.SESSION_DOMAIN must be set in .env.composer require spatie/laravel-cookie-consent
php artisan vendor:publish --provider="Spatie\CookieConsent\CookieConsentServiceProvider" --tag="cookie-consent-config"
.env and config/cookie-consent.php (e.g., COOKIE_CONSENT_ENABLED, cookie_lifetime).@include('cookie-consent::index')
resources/views/vendor/cookie-consent).// Laravel 11: bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
$middleware->append(\Spatie\CookieConsent\CookieConsentMiddleware::class);
});
php artisan vendor:publish --tag="cookie-consent-translations"
dialogContents.blade.php).App\Http\Middleware\BlockTrackers).en, fr, de) with easy customization.freek@spatie.be).SESSION_DOMAIN inHow can I help you explore Laravel packages today?