vouchedfor/consent-bundle
A Symfony bundle from VouchedFor for handling user consent in your application. It provides reusable building blocks to capture, store, and manage consent decisions, helping you integrate consent-aware behavior into PHP and Symfony projects.
Read this first: this is a Symfony bundle, not a Laravel package. There is no service provider, no config/consent.php, and no facade. If you are working inside a Laravel codebase you will either (a) pull it in as a dependency of a Symfony sub-application, or (b) treat it as a reference implementation and re-implement its consent-recording logic with Eloquent. Plan for that mismatch before you run composer require vouchedfor/consent-bundle.
Minimal steps in a Symfony app:
composer require vouchedfor/consent-bundle.config/bundles.php (Symfony Flex may do this for you): VouchedFor\ConsentBundle\ConsentBundle::class => ['all' => true].Resources/config/services.yml (or config/services.xml) inside the vendor directory first — this tells you the service IDs, the consent manager interface, and the Doctrine entity mappings you will actually inject.Entity/ (typically a Consent record tying a user/subject to a consent type, a source, a timestamp, and an action taken/granted flag). This is the schema you will live with.bin/console doctrine:schema:update --dump-sql to see the tables it wants to create before migrating.First real use case: record that a user has accepted your terms/privacy policy at signup, then query that consent later to decide whether to send marketing email. Inject the bundle's consent manager into your registration controller and call its record method — that is the whole loop.
Record-on-action. The dominant pattern is: a user performs an action (signs up, ticks a box, submits a cookie banner) → you call the consent manager with the subject, consent type, and a flag. Persist the surrounding context yourself (IP, user agent, policy version, form payload) because consent evidence is only useful if you can prove what they agreed to and when.
Guard-on-read. Before sending marketing, before setting non-essential cookies, before processing under a legal basis of consent, ask the manager "does subject X currently consent to Y?" Wrap that check in your own small service so controllers do not depend on the bundle directly — this makes the eventual replacement (or Laravel port) a one-file change.
Event/observer integration. If the bundle dispatches events on grant/withdraw (check Event/ and EventSubscriber/), subscribe to them to propagate consent changes to your CRM or mail provider. Treat withdrawal as first-class: the valuable behaviour is usually "user revoked marketing consent → stop sending," not "user granted it."
Versioned consent types. Model policy versions as distinct consent types (e.g. terms_v1, terms_v2) rather than overwriting a boolean. Re-prompting on a policy change then becomes a data query, not a migration.
Transactional writes. Record consent in the same transaction as the action it accompanies (e.g. the user row insert). A consent record that exists without the user, or vice versa, is an audit liability.
Testing. Because the bundle is thin and Doctrine-backed, unit-test your wrapper service against an in-memory SQLite/sqlite Doctrine connection rather than mocking the bundle's internals — you get real coverage of the persistence path.
composer.json.composer.json in the vendor directory — an old bundle may cap symfony/* at a version your stack has moved past, forcing you to loosen constraints or patch.schema:update.bin/console debug:container --show-private | grep -i consent will reveal the real service IDs, which are the fastest route to understanding the API when docs are missing.How can I help you explore Laravel packages today?