doublethreedigital/cookie-notice
A Laravel package for adding a customizable cookie consent notice to your site. Publish config and views, display a cookie banner, and let visitors accept or decline cookies with minimal setup.
Install the package and publish its config and views:
composer require duncanmcclean/cookie-notice
php artisan vendor:publish --tag="cookie-notice-config"
php artisan vendor:publish --tag="cookie-notice-views"
Open config/cookie-notice.php first — that is where the banner text, button labels, policy link, position, and cookie lifetime are defined. Then drop the widget into your main layout, usually just before the closing </body> tag:
@include('cookie-notice::widget')
The first realistic use case is gating analytics/marketing scripts: render the banner on every page, and only initialise tags like Google Analytics after the visitor has accepted. For a quick smoke test, load any page in a fresh private window and confirm the banner appears once, then disappears after choosing an option.
resources/views/vendor/cookie-notice/widget.blade.php) rather than editing vendor files when you need custom markup, extra buttons, or to match your design system.cookie-notice:accepted / cookie-notice:declined or your version's equivalents) to trigger analytics initialisation and to avoid duplicating cookie-parsing logic across scripts.withCookie, withoutCookie) to assert that gated content behaves correctly for accepted vs. undecided visitors.php artisan config:clear and php artisan view:clear are the first things to run when changes don't appear; cached config is a common cause of "the banner ignores my settings."vendor:publish tag and confirm your layout includes the package assets; with Vite setups, double-check the published asset paths.How can I help you explore Laravel packages today?