- 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.