{"id":22211777,"url":"https://github.com/harborn-digital/cookie-consent-bundle","last_synced_at":"2025-09-01T21:43:44.110Z","repository":{"id":40415428,"uuid":"168551037","full_name":"Harborn-digital/cookie-consent-bundle","owner":"Harborn-digital","description":" Symfony bundle to append Cookie Consent to your website to comply to AVG/GDPR for cookies.","archived":false,"fork":false,"pushed_at":"2024-06-20T09:22:34.000Z","size":509,"stargazers_count":25,"open_issues_count":25,"forks_count":26,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-19T13:06:55.511Z","etag":null,"topics":["managed","team-engineering-2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Harborn-digital.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-31T15:49:16.000Z","updated_at":"2025-07-25T19:27:40.000Z","dependencies_parsed_at":"2023-02-16T22:15:25.819Z","dependency_job_id":"11b811b8-9016-404f-9434-31e41e7cf6be","html_url":"https://github.com/Harborn-digital/cookie-consent-bundle","commit_stats":{"total_commits":101,"total_committers":23,"mean_commits":4.391304347826087,"dds":"0.48514851485148514","last_synced_commit":"8310ffa1506e02fed43c5968d41d9bd92942291e"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/Harborn-digital/cookie-consent-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harborn-digital%2Fcookie-consent-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harborn-digital%2Fcookie-consent-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harborn-digital%2Fcookie-consent-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harborn-digital%2Fcookie-consent-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Harborn-digital","download_url":"https://codeload.github.com/Harborn-digital/cookie-consent-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harborn-digital%2Fcookie-consent-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273197145,"owners_count":25062230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["managed","team-engineering-2"],"created_at":"2024-12-02T20:38:22.567Z","updated_at":"2025-09-01T21:43:44.073Z","avatar_url":"https://github.com/Harborn-digital.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ConnectHolland/cookie-consent-bundle/badges/quality-score.png?b=master\u0026s=15b793ae2474fa313d343c43f30ce4f9aa594f00)](https://scrutinizer-ci.com/g/ConnectHolland/cookie-consent-bundle/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/ConnectHolland/cookie-consent-bundle/badges/coverage.png?b=master\u0026s=d8e84bcf2e3e5bed47d4c6aa4702f246de74dbdf)](https://scrutinizer-ci.com/g/ConnectHolland/cookie-consent-bundle/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/ConnectHolland/cookie-consent-bundle/badges/build.png?b=master\u0026s=bcccde957df75df8622fa346ba348dee002efebb)](https://scrutinizer-ci.com/g/ConnectHolland/cookie-consent-bundle/build-status/master)\n\n\n# Cookie Consent bundle for Symfony\nSymfony bundle to append Cookie Consent to your website to comply to AVG/GDPR for cookies.\n\n## Installation\n\n### Step 1: Download using composer\nIn a Symfony application run this command to install and integrate Cookie Consent bundle in your application:\n```bash\ncomposer require connectholland/cookie-consent-bundle\n```\n\n### Step 2: Enable the bundle\nWhen not using symfony flex, enable the bundle in the kernel manually:\n```php\n\u003c?php\n// app/AppKernel.php\n\npublic function registerBundles()\n{\n    $bundles = array(\n        // ...\n        new ConnectHolland\\CookieConsentBundle\\CHCookieConsentBundle(),\n        // ...\n    );\n}\n```\n\n### Step 3: Enable the routing\nWhen not using symfony flex, enable the bundles routing manually:\n```yaml\n# app/config/routing.yml\nch_cookie_consent:\n    resource: \"@CHCookieConsentBundle/Resources/config/routing.yaml\"\n```\n\n### Step 4: Configure to your needs\nConfigure your Cookie Consent with the following possible settings\n```yaml\nch_cookie_consent:\n    theme: 'light' # light, dark\n    categories: # Below are the default supported categories\n        - 'analytics'\n        - 'tracking'\n        - 'marketing'\n        - 'social_media'\n    use_logger: true # Logs user actions to database\n    position: 'top' # top, bottom\n    simplified: false # When set to true the user can only deny or accept all cookies at once\n    http_only: true # Sets HttpOnly on cookies\n    form_action: $routeName # When set, xhr-Requests will only be sent to this route. Take care of having the route available.\n    csrf_protection: true # The cookie consent form is csrf protected or not\n```\n\n## Usage\n### Twig implementation\nLoad the cookie consent in Twig via render_esi ( to prevent caching ) at any place you like:\n```twig\n{{ render_esi(path('ch_cookie_consent.show')) }}\n{{ render_esi(path('ch_cookie_consent.show_if_cookie_consent_not_set')) }}\n```\n\nIf you want to load the cookie consent with a specific locale you can pass the locale as a parameter:\n```twig\n{{ render_esi(path('ch_cookie_consent.show', { 'locale' : 'en' })) }}\n{{ render_esi(path('ch_cookie_consent.show_if_cookie_consent_not_set', { 'locale' : app.request.locale })) }}\n```\n\n### Cookies\nWhen a user submits the form the preferences are saved as cookies. The cookies have a lifetime of 1 year. The following cookies are saved:\n- **Cookie_Consent**: date of submit\n- **Cookie_Consent_Key**: Generated key as identifier to the submitted Cookie Consent of the user\n- **Cookie_Category_[CATEGORY]**: selected value of user (*true* or *false*)\n\n### Logging\nAVG/GDPR requires all given cookie preferences of users to be explainable by the webmasters. For this we log all cookie preferences to the database. IP addresses are anonymized. This option can be disabled in the config.\n\n![Database logging](https://raw.githubusercontent.com/ConnectHolland/cookie-consent-bundle/master/Resources/doc/log.png)\n\n### Themes\n![Dark Theme](https://raw.githubusercontent.com/ConnectHolland/cookie-consent-bundle/master/Resources/doc/dark_theme.png)\n![Light Theme](https://raw.githubusercontent.com/ConnectHolland/cookie-consent-bundle/master/Resources/doc/light_theme.png)\n\n### TwigExtension\nThe following TwigExtension functions are available:\n\n**chcookieconsent_isCategoryAllowedByUser**\ncheck if user has given it's permission for certain cookie categories\n```twig\n{% if chcookieconsent_isCategoryAllowedByUser('analytics') == true %}\n    ...\n{% endif %}\n```\n\n**chcookieconsent_isCookieConsentSavedByUser**\ncheck if user has saved any cookie preferences\n```twig\n{% if chcookieconsent_isCookieConsentSavedByUser() == true %}\n    ...\n{% endif %}\n```\n\n\n## Customization\n### Categories\nYou can add or remove any category by changing the config and making sure there are translations available for these categories.\n\n### Translations\nAll texts can be altered via Symfony translations by overwriting the CHCookieConsentBundle translation files.\n\n### Styling\nCHCookieConsentBundle 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 Resources/public/css/cookie_consent.css. Colors can easily be adjusted by setting the variables available in the sass file.\n\nTo install these assets run:\n```bash\nbin/console assets:install\n```\n\nAnd include the styling in your template:\n```twig\n{% include \"@CHCookieConsent/cookie_consent_styling.html.twig\" %}\n```\n\n### Javascript\nBy loading Resources/public/js/cookie_consent.js the cookie consent will be submitted via ajax and the cookie consent will be shown on top of your website while pushing down the rest of the website.\n\n### Events\nWhen a form button is clicked, the event of cookie-consent-form-submit-successful is created. Use the following code to listen to the event and add your custom functionality.\n```javascript\ndocument.addEventListener('cookie-consent-form-submit-successful', function (e) {\n    // ... your functionality\n    // ... e.detail is available to see which button is clicked.\n}, false);\n```\n\n### Template Themes\nYou can override the templates by placing templates inside your project (except for Symfony 5 projects):\n\n```twig\n# app/Resources/CHCookieConsentBundle/views/cookie_consent.html.twig\n{% extends '@!CHCookieConsent/cookie_consent.html.twig' %}\n\n{% block title %}\n    Your custom title\n{% endblock %}\n```\n\n#### Template override for Symfony 5 projects\nYou can override the templates by placing templaces inside you project as below. Be careful, it is important to place templates at this location: \"app/templates/bundles/CHCookieConsentBundle/\" . \n```twig\n# app/templates/bundles/CHCookieConsentBundle/cookie_consent.html.twig\n{% extends '@!CHCookieConsent/cookie_consent.html.twig' %}\n\n{% block intro %}\n    Your custom intro\n{% endblock %}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharborn-digital%2Fcookie-consent-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharborn-digital%2Fcookie-consent-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharborn-digital%2Fcookie-consent-bundle/lists"}