Giter VIP home page Giter VIP logo

cookie-consent-bundle-1's Introduction

Cookie Consent bundle for Symfony

Symfony bundle to append Cookie Consent to your website to comply to AVG/GDPR for cookies.

Installation

In a Symfony application run this command to install and integrate Cookie Consent bundle in your application:

composer require connectholland/cookie-consent-bundle

Configure your Cookie Consent with the following possible settings

ch_cookie_consent:
    theme: 'light' # light, dark
    categories: # Below are the default supported categories
        - 'analytics'
        - 'tracking'
        - 'marketing'
        - 'social_media'
    excluded_routes: # Routes for which the cookie consent will not be loaded
        - 'app_cookies'
    excluded_paths: # Paths for which the cookie consent will not be loaded
        - '/cookies'

Dark theme: alt text

Light theme: alt text

Usage

On every (master) kernel request the cookie consent will automatically be loaded into your website when the visitor has not yet used the Cookie Consent form yet. After submitting the form a few cookies are saved ( with a lifetime of 1 year ). The cookie Cookie_Consent is saved with the date of submit and for each configured category a cookie saved e.g. Cookie_Category_analytics with it's value set to either true or false

Controller

A controller is available for renderering the cookie consent in a template.

TwigExtension

You can use the TwigExtension to check if user has given it's permission for certain cookie categories

{% if chcookieconsent_isAllowed('analytics') == true %}
    ...
{% endif %}

Customization

Categories

You can add or remove any category by changing the config and making sure there are translations available for these categories.

Translations

All texts can be altered via Symfony translations by overwriting the CHCookieConsentBundle translation files.

Styling

CHCookieConsentBundle comes with a default styling. A sass file is available in Resources/assets/css/cookie_consent.scss and a build css file is available in Resoureces/public/css/cookie_consent.css. Colors can easily be adjusted by setting the variables available in the sass file.

Javascript

By loading Resources/public/js/cookie_consent.js the cookie consent will be shown on top of your website while pushing down the rest of the website.

Template Themes

You can override the templates by placing templates inside your poject:

# app/Resources/CHCookieConsentBundle/views/cookie_consent.html.twig
{% extends '@!CHCookieConsent/cookie_consent.html.twig' %}

{% block title %}
    Your custom title
{% endblock %}

cookie-consent-bundle-1's People

Contributors

matthijsch avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.