scify/laravel-cookies-consent
A ready-to-use cookie consent solution for Laravel: display a customizable consent banner, manage cookie categories, log user consent, and restrict scripts until approval. Includes middleware, Blade views, config options, and multi-language support for GDPR-friendly compliance.
Architecture fit
scify/laravel-cookie-guard is a conventional Laravel package: a service provider, publishable config, publishable Blade components, a small set of routes, a published JS bundle, and translation files. It slots into the standard Laravel request lifecycle rather than requiring a separate service or build pipeline.POST /guard-settings/save, the server validates and persists it, and only then does the banner close. That is the right shape for a compliance-adjacent component — the audit trail and the UI state agree.web middleware grouping plus X-XSRF-TOKEN handling means it composes with Inertia, Livewire, and Turbo, which is where most modern Laravel apps actually live. That is a meaningful architectural improvement over a package that assumes full page reloads.Integration feasibility
data-cookie-lifetime, data-cookie-categories, data-required-categories, data-csrf-token). Customised or forked banner markup must be manually reconciled, or erasure and lifetime silently stop working.lang/vendor/cookies_consent/, which uses Laravel's key-by-key merge. This is a genuine ergonomic win — you keep only overridden strings and inherit later fixes — but it is a one-time migration for anyone who published the old lang/vendor/scify/laravel-cookie-guard/ path.Technical risk
POST /guard-settings/save was registered without middleware since the first release. Any in-house code that posts to that route (custom banners, SPA wrappers, test harnesses, QA scripts) will start receiving 419s. Laravel 13's same-origin exemption softens this, but it is not a guarantee across versions.required categories are excluded from rejection; cookie_lifetime now actually governs the browser-side consent cookie; 0 means session-only. Each of these changes what the product does with user data. None is a breaking API change, but all are behaviour changes a privacy owner should sign off on.se → sv breaks Swedish translations for any app configured with locale se. Fails soft (falls back to default strings), which makes it easy to miss.enabled config key. The notes state nothing read it, so risk is nominal — but any deployment that used it as a feature flag to disable the banner will find the banner now always active.node:test with 100% line coverage of the bundle, including a view-override test that boots the provider. For a package in the compliance path, that is the strongest evidence in these notes.Key questions
SameSite=Lax sufficient for the embedded/iframe or cross-subdomain banner scenarios some customers run, or is that configurable?Stack fit
se locale, apps that disabled the banner via enabled, and apps with bespoke code posting to the save route.Migration path
php artisan vendor:publish --tag="cookies-consent-public" --force to refresh assets.lang/vendor/cookies_consent/{locale}/messages.php and delete the legacy directory.se is in use, switch to sv and verify string resolution./guard-settings/save and add the CSRF token.enabled config key.Compatibility
data-* root attributes are effectively required for correct behaviour but are not enforced by a runtime check or a console warning in old markup. Locale se is silently degraded. Custom save-route callers break on CSRF.composer.json before scheduling.Sequencing
enabled was relied on.use_separate_page mode, hash-link entry, floating button via keyboard. Verify cookies are actually removed from the browser and from parent domains.cookie_lifetime, that Secure/SameSite attributes are present, and that erasure fires on rejection. Check logs for the legacy translation-directory warning and clear it.Maintenance
Support
Scaling
Failure modes
| Failure | Symptom | Detection | Blast radius |
|---|---|---|---|
| Components not re-published | Rejection erases nothing; lifetime ignores config | None — silent | Compliance; surfaces in audit |
| In-house save-route caller without CSRF | 419 on consent save | Server logs / browser console | Banner stays open, consent not recorded |
Locale se still configured |
English/default strings appear | Visual QA | Cosmetic-to-regulatory depending on jurisdiction |
enabled relied upon |
Banner appears where it was suppressed | Visual QA on next deploy | User-visible regression |
| Save request fails (network/5xx) | Banner remains open | Client-side only | User cannot dismiss; UX friction, but correct-by-design (no false consent) |
Misconfigured cookie name/domains |
Erasure misses cookies on sibling subdomains | Manual browser inspection | Residual tracking after rejection |
| Non-standard TLD / multi-tenant host | Registrable-domain calculation picks wrong scope | Manual inspection | Over- or under-erasure |
Ramp-up
se→sv note. This is a package where the failure mode is silence, so the runbook is the control.How can I help you explore Laravel packages today?