{"id":15077657,"url":"https://github.com/eveltic/cookie-bundle","last_synced_at":"2026-02-09T23:32:57.402Z","repository":{"id":253842850,"uuid":"844713396","full_name":"eveltic/cookie-bundle","owner":"eveltic","description":"A Symfony bundle for managing user cookie consent in compliance with the 2024 AEPD regulations.","archived":false,"fork":false,"pushed_at":"2024-08-20T10:21:06.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T07:23:22.202Z","etag":null,"topics":["aepd","bundle","consent","cookie","symfony","symfony-bundle"],"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/eveltic.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":"2024-08-19T20:27:23.000Z","updated_at":"2024-08-20T10:20:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"81d036a7-6838-4ec7-8a66-0917e33815b5","html_url":"https://github.com/eveltic/cookie-bundle","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"87e13526709318efcc961b20a7e8a80d7390bafc"},"previous_names":["eveltic/cookie-bundle"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eveltic%2Fcookie-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eveltic%2Fcookie-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eveltic%2Fcookie-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eveltic%2Fcookie-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eveltic","download_url":"https://codeload.github.com/eveltic/cookie-bundle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239370679,"owners_count":19627471,"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","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":["aepd","bundle","consent","cookie","symfony","symfony-bundle"],"created_at":"2024-09-25T04:05:40.038Z","updated_at":"2026-02-09T23:32:57.389Z","avatar_url":"https://github.com/eveltic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eveltic Cookie Bundle\nThe Eveltic Cookie Consent Bundle is a Symfony package to implement and manage user cookie consents on websites, thus complying fully with the newest 2024 AEPD regulations.\nIt provides an easy-to-use interface to configure, collect, and store the preferences of user consent.\n\nDifferent types of cookie settings can be configured for technical, analytical, preference, and advertisement cookies. It features easy-to-use templates, multilingual support, and is easy to implement in Symfony applications to ensure that your website is within the bounds of the law.\n\nAll operations are managed through ajax requests without the need of any refresh.\n\n## Images\n### Banner\n![image](https://github.com/user-attachments/assets/a85bdea7-112d-45f6-84ac-796f0f726508)\n## Configure cookies\n![image](https://github.com/user-attachments/assets/7f6d3992-321a-4cc5-aada-c0c3b7a149d1)\n## Retract from consent\n### Floating button\n![image](https://github.com/user-attachments/assets/f05f91a3-5beb-42e1-8059-c51ad444ffa6)\n### Retract button and consent details\n![image](https://github.com/user-attachments/assets/aa399f8a-2929-4e93-967f-99776be9e3d0)\n![image](https://github.com/user-attachments/assets/3c858473-498c-4304-ac83-14d4a6a69af9)\n\n\n## Features\n- Manage cookie consent categories: technical, preferences, analytics, and ads (you can configure all categories adding or removing according to your needs).\n- Configure expiration period for cookies.\n- Support for light, dark, and auto theme modes.\n- Command line tools for archiving cookie consent data.\n- Integration with Doctrine ORM.\n- Fully featured twig display.\n- Twig and backend functions to check if consent is accepted.\n- Cookie versioning to force the user to reconsent.\n\n## Installation\n1. Require the Bundle via Composer:\nThis command will download and install this bundle inside your composer folder.\n```bash\ncomposer require eveltic/cookie-bundle\n```\n2. Run install command\nThis command will create the necesary files in order to be able to adequate to your configuration needs.\n```bash\nphp bin/console ev:cookie:install\n```\n3. Update the database\nIf you force update the database:\n```bash\nphp bin/console doctrine:schema:update --force\n```\nor if you are using migrations:\n```bash\nphp bin/console make:migration\nphp bin/console doctrine:migrations:migrate\n```\n4. Add the functions to your template (View Usage section)\n```twig\n{{ ev_cookie_include_assets() }}\n{{ ev_cookie_render() }}\n````\n## Uninstall\nSince there is no flex recipe, when uninstalling this bundle you need to manually remove the config files that were installed with the installation command. If you uninstall the bundle and doesn't remove those files the app will throw and exception telling you about this problem.\n\n## Configuration\nIf you ran the installation command all configuration files were in their corresponding folder.\nIf you dont ran the command and you want to configure these are the files you need:\n\u003e config/packages/eveltic_cookie.yaml\n```yaml\neveltic_cookie:\n    categories:\n      - name: \"technical\"\n        required: true\n      - name: \"preferences\"\n        required: false\n      - name: \"analytics\"\n        required: false\n      - name: \"ads\"\n        required: false\n    domain: null\n    expiration: \"+2 years\"\n    version: 1\n    theme_mode: auto # 'light', 'dark', 'auto'\n```\n### Available Configuration Options\n- `categories`: Define the categories of cookies and whether they are required.\n- `domain`: Set the domain for the cookies.\n- `expiration`: Set the cookie expiration period.\n- `version`: Specify the version of your cookie consent policy.\n- `theme_mode`: Choose the theme mode for the consent dialog ('light', 'dark', 'auto').\n\n\u003e config/routes/eveltic_cookie.yaml\n```yaml\neveltic_cookie:\n    resource:\n        path: '@EvelticCookieBundle/src/Controller/'\n        namespace: Eveltic\\CookieBundle\\Controller\n    type: attribute\n    prefix: /\n```\n\n## Usage\n### Functions\n#### Twig Functions\n\n\u003e {{ ev_cookie_render() }}\n\nRenders the cookie consent banner. This function generates the HTML content for displaying the cookie consent dialog based on the user's current preferences.\nThis function should be included in a layout or template where you want the cookie consent banner to appear.\n\n\u003e {{ ev_cookie_is_category_accepted('analytics') }}\n\n\u003e {{ ev_cookie_is_category_accepted(['technical', 'analytics'])) }}\n\nChecks if a specific cookie category (e.g., \"technical\", \"analytics\") is accepted by the user.\nThis function is useful for conditionally loading scripts or other assets based on the user's consent for specific categories.\nThis function support both string and array inputs. If you provide an array input both conditions must be true to return true.\n\u003e {{ ev_cookie_show_cookie_banner() }}\n\nDetermines if the cookie consent banner should be shown to the user. This typically checks if the user has already provided consent.\nThis function allows you to control whether the consent banner should be displayed, avoiding unnecessary re-rendering.\n\u003e {{ ev_cookie_include_js() }}\n\nIncludes the JavaScript necessary for handling cookie consent interactions on the frontend.\nPlace this in your template to ensure the necessary JavaScript is included for managing cookie consent.\n\u003e {{ ev_cookie_include_css() }}\n\nIncludes the CSS styles for the cookie consent banner.\nThis function is used to add the styling needed for the cookie consent banner.\n\u003e {{ ev_cookie_include_assets() }}\n\nIncludes both the JavaScript and CSS assets required for the cookie consent banner in one go.\nThis function is a convenience method to include both the JavaScript and CSS with a single function call, making it easier to integrate into your templates.\n\nUsage Example\n ```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003eMy Website\u003c/title\u003e\n    {{ ev_cookie_include_assets() }}\n\u003c/head\u003e\n\u003cbody\u003e\n    {{ ev_cookie_render() }}\n\n    {% if ev_cookie_is_category_accepted('analytics') %}\n        \u003c!-- Create analytics cookies --\u003e\n    {% endif %}\n\n    \u003c!-- Your content here --\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n#### Backend Functions Provided by CookieConsentService\n\u003e $cookieConsentService-\u003egetConsent()\n\nRetrieves the current cookie consent data from the user's session or cookies.\n```php\n$consent = $cookieConsentService-\u003egetConsent();\n\nif ($consent) {\n    // Process the consent data\n} else {\n    // Handle the case where no consent has been given\n}\n```\n\u003e $cookieConsentService-\u003ehasConsented()\n\nChecks whether the user has already provided consent for cookies. This function can be used to determine whether to display the cookie consent banner.\n```php\nif ($cookieConsentService-\u003ehasConsented()) {\n    // User has already consented\n} else {\n    // Show consent banner or take appropriate action\n}\n```\n\u003e $cookieConsentService-\u003eisCategoryAccepted(string $category)\n\nDetermines if a specific cookie category has been accepted by the user.\n  - Parameters:\n    - $category: The name of the cookie category you want to check (e.g., \"analytics\", \"preferences\").\n```php\nif ($cookieConsentService-\u003eisCategoryAccepted('analytics')) {\n    // Load analytics scripts or perform actions that require analytics cookies\n}\n```\n\n### Commands\n```command\nphp bin/console ev:cookie:install\n```\nInstalls the necessary assets and settings for the cookie consent management.\n```command\nphp bin/console ev:cookie:archive\nphp bin/console ev:cookie:archive --date=2023-01-01 --output-format=csv\nphp bin/console ev:cookie:archive --date=2023-01-01 --dry-run\n```\nArchives old cookie consent data to keep your database clean.\n#### Parameters\n- `--date`: (optional) Allows you to specify a date in the Y-m-d format (e.g., 2023-01-01). This parameter indicates that all records before this date will be archived.\n- `--output-format`: (optional) Specifies the output format for the archived records. Available options are:\n  - `log`: Saves the archived records in a LOG file.\n  - `csv`: Saves the archived records in a CSV file.\n  - `html`: Saves the archived records in an HTML file.\n- `--dry-run`: (optional) Performs a simulation of the archiving process without actually modifying any data in the database. This is useful for previewing which records would be archived without making permanent changes.\n\n## Translations\nThis bundle supports multiple languages for the consent banner. Available translations include:\n- German (de)\n- Spanish (es)\n- French (fr)\n- Italian (it)\n- Dutch (nl)\n- Polish (pl)\n- Portuguese (pt)\n- Russian (ru)\n- Catalan (ca)\n\n## Contributing\nContributions are welcome! Please fork the repository and submit a pull request for any features, bug fixes, or improvements.\n\n## License\nThis bundle is released under the MIT License. See the LICENSE file for more details. Feel free to use in any condition and modify all as you want.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feveltic%2Fcookie-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feveltic%2Fcookie-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feveltic%2Fcookie-bundle/lists"}