Spatie Laravel Cookie Consent
Spatie Laravel Cookie Consent is a lightweight open source PHP package by Belgian agency Spatie that displays a basic cookie notice on Laravel applications. It writes a single first party cookie (laravel_cookie_consent) to remember the dismissal and does not call any third party service. Used alone, it is more an information banner than a full consent management platform: blocking trackers and giving granular consent must be implemented separately.
What does Spatie Laravel Cookie Consent do?
What is Spatie Laravel Cookie Consent?
Spatie Laravel Cookie Consent is a small composer package developed by Belgian agency Spatie. It adds a simple cookie notice to a Laravel application: when the visitor lands on the site, a Blade rendered dialog tells them that the site uses cookies, and provides a button to dismiss the notice. It is widely used by Laravel developers in Europe as a lightweight first step toward compliance.
Cookies and identifiers
The package sets a single first party cookie named laravel_cookie_consent on the application domain. It contains a value of 1 indicating that the visitor has dismissed the banner. The cookie has no tracking purpose and no personal data leaves your Laravel application.
GDPR and ePrivacy implications
The laravel_cookie_consent cookie qualifies as strictly necessary for the consent exemption of Article 5(3) ePrivacy because it remembers the user's expressed choice. The package itself does not load any third party tracker, so it does not by itself create privacy obligations beyond proper transparency.
What it does not do
The package is informational. It does not block analytics, advertising or social plugins, it does not provide categorised consent (necessary, statistics, marketing), and it does not generate proof of consent compliant with EDPB guidelines. Used alone with Google Analytics or Meta Pixel loaded directly in the layout, your Laravel app remains non compliant.
Combining it with proper consent gating
To reach actual GDPR/ePrivacy compliance, combine Spatie Laravel Cookie Consent with a real CMP (Klaro!, CookieYes, Cookiebot or a custom Vue/React banner) that gates third party scripts on a per category consent. Alternatively, replace the package with a fully featured open source CMP that natively integrates with Laravel's Blade templates.
Implementing it correctly
Treat the package as a UI helper for the cookie notice. Customise the message to clearly describe what cookies are set and link to a separate cookie policy. Combine it with conditional Blade includes that load analytics or ads only after a real consent is captured. Document the laravel_cookie_consent cookie in your privacy policy as strictly necessary.
Spatie Laravel Cookie Consent and the GDPR
- Legal basis
- The single cookie set is strictly necessary to remember the visitor's choice and falls under the consent exemption of Article 5(3) ePrivacy. No personal data leaves the controller's infrastructure.
- Risk level
- low
- Applicable regulations
- GDPR, ePrivacy Directive (cookie strictly necessary exemption)
Impact assessment (DPIA)
A DPIA is not required for the package itself because no personal data is processed beyond a single first party cookie. The DPIA scope shifts to the trackers your Laravel app loads (analytics, ads, social plugins), which the package does not block on its own.
Sample text for your banner
This site uses Spatie Laravel Cookie Consent to display a cookie notice. A first party cookie (laravel_cookie_consent) is stored on your device to remember that you have dismissed the banner. No data is sent to any third party.
What Spatie Laravel Cookie Consent sets and contacts
- Tracking method
- Server side Laravel package (spatie/laravel-cookie-consent) plus a small front end Blade dialog. The package writes a single first party cookie (laravel_cookie_consent) to remember whether the visitor has dismissed the banner, and renders the dialog HTML server side.
- Server location
- Self hosted by the controller (no third party endpoint is contacted).
- Cookieless mode available
- Yes
Cookies set (1)
| Name | Type | Duration | Purpose |
|---|---|---|---|
| laravel_cookie_consent | first_party | 1 year | Stores the visitor's acknowledgement of the cookie notice so the dialog is not displayed again. Strictly necessary cookie, exempt from consent. |
Third-party domains contacted (2)
github.com/spatie/laravel-cookie-consentpackagist.org
Frequently asked questions about Spatie Laravel Cookie Consent
Can't find your question? Write to us, we answer fast.
Which cookies does Spatie Laravel Cookie Consent set?
It sets a single first party cookie named laravel_cookie_consent on the application domain to remember that the visitor has dismissed the cookie notice.
Does it require consent?
No, the laravel_cookie_consent cookie is strictly necessary to remember the visitor's choice and falls under the consent exemption of Article 5(3) ePrivacy. The package itself does not load any third party tracker.
What is the legal basis?
Storage of the cookie is exempted from consent because it is strictly necessary. Tracking obligations come from the other scripts of your Laravel app, which the package does not block.
Are data transferred outside the EU?
No, the package is self contained inside your Laravel application. It does not call any external API and does not generate transfers.
Do I need a DPIA?
No DPIA is required for the package itself. A DPIA may still be needed for the trackers your Laravel app loads (analytics, ads, social plugins) which are not blocked by Spatie Laravel Cookie Consent.
How do I make my Laravel app actually compliant?
Combine the package with conditional Blade includes or with a real CMP (Klaro!, CookieYes, Cookiebot) that gates third party scripts on a per category consent. Document the cookies in a dedicated cookie policy.
Are there alternatives?
For a real CMP integrated with Laravel, consider Klaro!, Cookiebot, CookieYes, or building a custom Vue/Livewire banner with consent state propagated to the back end.
How do I describe it in my cookie policy?
List the laravel_cookie_consent cookie as strictly necessary, with its 1 year duration and its sole purpose: remembering that the visitor dismissed the notice. No third party processor is involved.
Metomic
Metomic is a web technology service that provides essential functionality for websites and digital platforms. It delivers core capabilities that support site operations, content delivery, and user experience optimization. Metomic integrates seamlessly with modern web architectures, ensuring reliable performance and compatibility across browsers and devices. Trusted by businesses worldwide, Metomic helps organizations maintain robust websites that meet user expectations and technical requirements.
Enzuzo
Enzuzo is a web technology service that provides essential functionality for websites and digital platforms. It delivers core capabilities that support site operations, content delivery, and user experience optimization. Enzuzo integrates seamlessly with modern web architectures, ensuring reliable performance and compatibility across browsers and devices. Trusted by businesses worldwide, Enzuzo helps organizations maintain robust websites that meet user expectations and technical requirements.
OneTrust
OneTrust is a foundational web service that powers critical website functions and digital experiences. It provides reliable infrastructure, seamless integration capabilities, and consistent performance across all devices and browsers. OneTrust supports modern development practices and scales with growing business needs. With a focus on stability and compatibility, OneTrust ensures your website delivers a smooth, uninterrupted experience to every visitor and search engine crawler.
CookieFirst
CookieFirst is a foundational web service that powers critical website functions and digital experiences. It provides reliable infrastructure, seamless integration capabilities, and consistent performance across all devices and browsers. CookieFirst supports modern development practices and scales with growing business needs. With a focus on stability and compatibility, CookieFirst ensures your website delivers a smooth, uninterrupted experience to every visitor and search engine crawler.
Sourcepoint
Sourcepoint is a foundational web service that powers critical website functions and digital experiences. It provides reliable infrastructure, seamless integration capabilities, and consistent performance across all devices and browsers. Sourcepoint supports modern development practices and scales with growing business needs. With a focus on stability and compatibility, Sourcepoint ensures your website delivers a smooth, uninterrupted experience to every visitor and search engine crawler.
KIProtect
Kiprotect is a foundational web service that powers critical website functions and digital experiences. It provides reliable infrastructure, seamless integration capabilities, and consistent performance across all devices and browsers. Kiprotect supports modern development practices and scales with growing business needs. With a focus on stability and compatibility, Kiprotect ensures your website delivers a smooth, uninterrupted experience to every visitor and search engine crawler.
Make your site compliant today.
Free up to 25,000 sessions a month. No credit card, no commitment.