How to Use Cookies With AlpineJS
– releasecandidate.dev - submitted by Peter
Here's a simple approach on how to use cookies with AlpineJS
Read more [releasecandidate.dev]
Posts tagged with cookie
– releasecandidate.dev - submitted by Peter
Here's a simple approach on how to use cookies with AlpineJS
Read more [releasecandidate.dev]
Did you know that using stream contexts, you can set headers when making HTTP requests with #php's file_get_contents() function? pic.twitter.com/bBoS5bksbt
— Liam Hammett (@LiamHammett) August 24, 2018
Read more [twitter.com]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
"Always fresh, useful tips and articles. Carefully selected community content. My favorite newsletter, which I look forward to every time."
No spam. Unsubscribe anytime. You can also follow me on X.
All sites owned by EU citizens or targeted towards EU citizens must comply to a crazy EU law. This law requires a dialog to be displayed to inform the users of your websites how cookies are being used. You can read more info on the legislation on the site of the European Commission. The newest Laravel package made by my colleagues at Spatie and myself makes your app compliant with that law.
Once installed the package will render the following dialog that, when styled, will look very much like this one:
![]()
When the user clicks "Allow cookies" a laravel_cookie_consent cookie will be set and the dialog will be removed from the DOM. On the next request Laravel will notice that the laravel_cookie_consent has been set and will not display the dialog again.
We've made it easy to customize the texts shown by the dialog. You can also make changes to the dialog or JavaScript itself.
The legislation is pretty very vague on how to display the warning, which texts are necessary, and what options you need to provide. This package will go a long way towards compliance, but if you want to be 100% sure that your website is ok, you should consult a legal expert.
Take a look at the package on GitHub to learn how to install the package and which options it provides. If you like it, be sure to check out our full list of Laravel packages.