承接 setono/consent-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

setono/consent-bundle

Composer 安装命令:

composer require setono/consent-bundle

包简介

A Symfony bundle that integrates the consent contracts

README 文档

README

Latest Version Software License Build Status Code Coverage Mutation testing

This bundle integrates the consent contracts into Symfony.

Installation

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.

Configuration

Consents

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

setono_consent:
    consents:
        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.

Consent checker

If you want to use a different consent checker, you can easily do so by implementing the ConsentCheckerInterface and setting your own service id as the consent checker:

# config/packages/setono_consent.yaml
setono_consent:
    consent_checker: <your service id>

Usage

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:

<?php
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)) {
            return;
        }
        
        // do your marketing tracking
    }
}

统计信息

  • 总下载量: 62.64k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固