Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Cookie Consent Bundle

Cookie Consent Bundle Laravel Package

pierre-brtrd/cookie-consent-bundle

A Symfony bundle for adding a configurable cookie consent banner to your application, letting visitors accept or reject cookies and helping you meet GDPR and ePrivacy requirements with minimal setup. Provides templates, configuration options, and JavaScript hooks for customizing consent behavior.

View on GitHub
Deep Wiki
Context7

Cookie Consent Bundle provides a ready-to-use cookie consent banner for Symfony applications. It helps you collect and store visitor consent for cookie categories, making it easier to meet GDPR requirements while keeping integration simple.

  • Configurable cookie categories and consent texts
  • Twig integration for rendering the banner
  • JavaScript API to react to consent changes
  • Persistent consent storage and revocation support
  • Symfony configuration and service integration
Frequently asked questions about Cookie Consent Bundle
How do I install pierre-brtrd/cookie-consent-bundle in a Symfony application?
Install it with Composer using composer require pierre-brtrd/cookie-consent-bundle, then register the bundle in config/bundles.php if Symfony Flex does not do it for you. After that, publish or import the bundle configuration and include the provided Twig template in your base layout. Check the repository README for the exact bundle alias, configuration prefix and template path, since these are version specific.
Can I use this cookie consent bundle in a Laravel application?
No. This is a Symfony bundle built around Symfony's bundle system, service container and Twig templating, so it will not install or boot inside a Laravel app. Laravel developers should look at Laravel-native options such as spatie/laravel-cookie-consent, or a front-end consent management script that works independently of the framework. The underlying idea of cookie categories and gated scripts is the same, but the integration code is not portable.
How do I block analytics or marketing scripts until the visitor accepts cookies?
The bundle's core feature is gating non-essential scripts behind cookie categories, so you configure your categories first and then conditionally output third-party snippets based on the visitor's consent state. In practice you wrap your Google Analytics, pixel or chat widget markup in a Twig condition that only renders once the relevant category has been accepted. Check the README for the exact Twig variables or helper functions exposed by the bundle, as naming differs between releases.
Can I define my own cookie categories, such as necessary, analytics and marketing?
Yes, cookie categories are the central configuration concept of the bundle. You declare groups in the bundle configuration and give each one a title and description that is shown in the consent notice, with strictly necessary cookies always enabled and everything else opt-in. This maps cleanly onto the granular consent that GDPR and AVG expect.
How do I customize the consent banner text and styling?
The notice text is set through the bundle configuration, and the visual appearance comes from the bundle's Twig templates. Override those templates in your application's templates/bundles directory rather than editing files in vendor, and add your own CSS classes or styles to match your design system. Keeping overrides in your app also means Composer updates will not wipe your changes.
Which Symfony and PHP versions does this bundle support?
Support depends entirely on the version you install, so read the require section of the composer.json on GitHub or Packagist before adding it to a project. Because the bundle relies on standard Symfony bundle conventions and Twig, it generally tracks the Symfony versions that were current when it was last released. On older or very new Symfony releases, test on a branch first and pin the version in composer.json.
How do I test that the cookie consent banner and script gating actually work?
Use Symfony's WebTestCase and KernelBrowser to request pages and assert that the banner markup is present in the response. Then assert that gated third-party snippets are absent from the HTML until the consent cookie or session value is set, and simulate acceptance to confirm they appear. This gives you regression coverage for the one behaviour that matters legally, which is not loading non-essential scripts before consent.
Is this bundle enough to be GDPR or AVG compliant?
It handles the visible part of compliance: showing a notice, capturing category-level consent and withholding non-essential scripts. Full compliance also requires a cookie policy, a way to withdraw consent later, and record keeping that suits your organisation, which a front-end bundle cannot provide on its own. Treat it as a technical building block and confirm your obligations with legal advice.
How does the bundle render the banner in a page?
It ships Twig templates, so you include the bundle's template or partial in your base layout and the banner appears on every page that extends it. If your layout is composed differently, you can also render the bundle's controller from Twig, depending on what the version exposes. Read the README for the exact include path and any required CSS or JavaScript assets.
Is pierre-brtrd/cookie-consent-bundle actively maintained, and what are the alternatives?
Check the GitHub repository for recent commits, tagged releases and open issues before committing to it in production, since smaller bundles like this one can go long stretches between releases. If maintenance looks stale, alternatives include front-end consent managers and hosted CMPs that are framework agnostic, plus Symfony-specific consent bundles. Whichever you choose, pin the version in composer.json so an abandoned package does not break your build unexpectedly.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console