A Symfony bundle that integrates the consent contracts

Installs: 46 582

Dependents: 4

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0


v1.1.0 2024-04-09 07:00 UTC

This package is auto-updated.

Last update: 2024-07-09 07:43:47 UTC


Latest Version Software License Build Status Code Coverage Mutation testing

This bundle integrates the consent contracts into Symfony.


composer require setono/consent-bundle

This installs and enables the plugin automatically if you're using Symfony Flex. If not, add the bundle manually to bundles.php.


The default configuration has all (default) consents (marketing, preferences, and statistics) set to false. If you want to change these defaults, you can easily do so:

# config/packages/setono_consent.yaml

        marketing: true
        preferences: true
        statistics: true
        random_consent: true # you can easily add your own consents

The above configuration will effectively change the default consent to true for all permissions.


The bundle provides a StaticConsentChecker that uses the above consents array as an input. You can then autowire the ConsentCheckerInterface and check for a granted consent:

use Setono\Consent\Consents;
use Setono\Consent\ConsentCheckerInterface;

final class YourMarketingTrackingService
    private ConsentCheckerInterface $consentChecker;
    public function __construct(ConsentCheckerInterface $consentChecker) {
        $this->consentChecker = $consentChecker;
    public function track(): void
        if(!$this->consentChecker->isGranted(Consents::CONSENT_MARKETING)) {
        // do your marketing tracking