- Can I use ongr/cookies-bundle in a Laravel application?
- No, not as a dependency. It is a Symfony bundle registered through AppKernel or bundles.php and configured under an ongr_cookies key, and Laravel has no bundle system or AppKernel. Composer resolution will almost certainly fail on a modern Laravel app, so treat it as a reference design rather than something you install.
- What does ongr/cookies-bundle actually do?
- It models each cookie as a tagged Symfony DI service managed by a CookieManager, so cookie definitions live in configuration instead of scattered magic strings. It centralizes cookie consent and cookie policy configuration and ships Twig helpers for rendering notices and conditionally loading scripts. The goal is meeting GDPR requirements without duplicating cookie logic across templates.
- Why does composer require ongr/cookies-bundle fail on Laravel 10 or 11?
- The last release dates from June 2016, so its constraints target symfony/framework-bundle ~2.3|~3.0 and PHP 5.5/7.0. Laravel 9 through 11 run on PHP 8.1 to 8.4 with Symfony 6/7 components, so the dependency graph cannot resolve. Even with platform requirements ignored, Laravel's container is not a drop-in host for a Symfony Bundle subclass.
- What is the Laravel equivalent of a cookie defined as a tagged Symfony service?
- Put an entry in config/cookies.php holding the key, category, lifetime and flags, then bind a CookieRegistry or CookieManager singleton in a service provider using mergeConfigFrom. Map the bundle's YAML config tree to that file and replace Twig helpers with Blade directives such as @cookieconsent('analytics'). Laravel's HTTP layer already ships symfony/http-foundation, so the underlying Cookie value object maps cleanly.
- Can I force-install ongr/cookies-bundle with --ignore-platform-reqs?
- You can get the files onto disk, but you will not get a working integration. The bundle's compiler passes and service definitions assume Symfony's DI semantics from that era, and its listeners and Twig extensions are wired for Symfony's event system. The effort spent forcing it in exceeds the couple of days needed to reimplement the pattern natively.
- Is ongr/cookies-bundle maintained and safe to use in production?
- It has had no release since 2016, around four stars and zero dependents, so there is effectively no community scrutiny and no security response path. Its cookie defaults also predate SameSite support in setcookie plus modern __Host- and Partitioned guidance, so the flags would need hardening. The code is small and MIT-licensed, so IP risk is nil, but staleness risk is high.
- How do I implement cookie consent in Laravel without this bundle?
- Reimplement the pattern natively: a config-driven cookie registry, a manager singleton, consent persistence in a first-party cookie, and Blade directives that gate analytics or marketing scripts. Middleware or a response listener attaches the consent state to outgoing responses. The source is only a few hundred lines, so this is typically two to five engineering days.
- Which Symfony features does the bundle rely on that Laravel lacks?
- It depends on the bundle system with AppKernel or bundles.php registration, a YAML config tree under ongr_cookies, and tagged DI services resolved through the container. It also uses Twig extensions for cookie helpers and Symfony event and listener wiring. Laravel has none of that out of the box, though its container, config repository and Blade can express the same design.
- How does cookie consent interact with full-page caching or a CDN in Laravel?
- A consent decision cannot be baked into cached HTML, so keep the notice and any conditionally loaded scripts out of the cached response. Render that state client-side, or exclude the relevant fragments from the cache and vary responses appropriately. The bundle does not solve this for you either, so it stays a design constraint of your own implementation.
- What alternatives exist to ongr/cookies-bundle for Laravel cookie consent?
- Look at spatie/laravel-cookie-consent or whitecube/laravel-cookie-consent, or build a thin first-party wrapper around Laravel's CookieJar. Which one fits depends on whether your requirement is real consent management with categories and revocation, or just cookie-as-service ergonomics. Also confirm which regimes you must satisfy, GDPR/ePrivacy, CCPA/CPRA or internal policy, since that defines the acceptance criteria.