Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ekyna/cookieconsentbundle
Cookie consent (GDPR).
https://github.com/ekyna/cookieconsentbundle
Last synced: 9 days ago
JSON representation
Cookie consent (GDPR).
- Host: GitHub
- URL: https://github.com/ekyna/cookieconsentbundle
- Owner: ekyna
- License: mit
- Created: 2019-06-17T14:52:46.000Z (over 5 years ago)
- Default Branch: 0.7
- Last Pushed: 2022-07-04T08:39:11.000Z (over 2 years ago)
- Last Synced: 2024-08-08T16:50:29.987Z (3 months ago)
- Language: PHP
- Size: 39.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
CookieConsentBundle
==============## Installation
composer require ekyna/cookie-consent-bundle
#### Register bundle and routes```php
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ...
new Ekyna\Bundle\CookieConsentBundle\EkynaCookieConsentBundle(),
];
// ...
}
``````yaml
# app/config/routing.yml
ekyna_cookie_consent:
resource: "@EkynaCookieConsentBundle/Resources/config/routing.yaml"
```#### Use twig functions
```twig
{# base.html.twig #}
{# ... #}
{% block javascripts %}
{# Renders the cookie consent widget (if not yet consented) #}
{{ ekyna_cookie_consent_render() }}
{# Check if cookie category has user consent ('analytic', 'marketing' or 'social_network') #}
{% if ekyna_cookie_consent_category_allowed('analytic') %}
{% endif %}
{% endblock javascripts %}```
_ekyna_cookie_consent_render()_ options with their default values:
```twig
{{ ekyna_cookie_consent_render({
render_if_saved: false, // Whether to render even if consent has been saved.
expanded: false, // Whether to show settings
dialog: true // Whether to render as a dialog/popup
}) }}
```#### Configuration
Available configuration with default values.
```yaml
# app/config/config.yml
ekyna_cookie_consent:
name: Cookie_Content # The consent cookie name
read_more_route: ~ # Route name to your privacy policy page
position: centered # Widget positioning ('centered' or 'bottom-right')
categories: # Cookies categories the user has to consent
- analytic
- marketing
- social_network
persist: true # Whether to persist user consent
```## TODO
* Encrypt cookie consent entity's __IP__ property.