devrabiul/laravel-cookie-consent
GDPR-compliant cookie consent for Laravel with one-click setup and no frontend dependencies. Fully customizable banners with RTL/i18n, dark mode, responsive UI, and granular category controls (necessary/analytics/marketing) for enterprise-grade compliance.
{!! CookieConsent::styles() !!}) may require adjustments for non-Blade templates.ConsentMiddleware) to block analytics scripts until consent is granted.js_action callbacks (e.g., loadGoogleAnalytics), introducing dependency on frontend dev resources.cookie() helper; ensure SameSite/Secure flags align with your security policies.analytics category) trigger/disable third-party scripts (GA, FB Pixel)?composer require devrabiul/laravel-cookie-consent.php artisan vendor:publish --provider="Devrabiul\CookieConsent\CookieConsentServiceProvider".bar-inline layout (lowest intrusiveness) and basic categories.events:listen for consent changes).classList).config/cookie-consent.php (categories, lifetimes, themes).analytics not consented).CookieConsent::styles() to <head> and CookieConsent::scripts() to <body>.loadGoogleAnalytics) in a separate file..example.com vs. example.com).| Scenario | Impact | Mitigation |
|---|---|---|
| JS Disabled | Banner invisible; no consent logged | Provide fallback cookie consent form. |
| Cookie Blocked | Consent not persisted | Use localStorage fallback (custom JS). |
| Database Failure | Consent states lost | Cache consent in Redis/memcached. |
| Third-Party Script Fails | Analytics broken | Implement retry logic in JS actions. |
How can I help you explore Laravel packages today?