Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/slicohp/didublab-cookielawbundle

A simple Symfony bundle to display a cookie law message.
https://github.com/slicohp/didublab-cookielawbundle

cookie-consent symfony symfony-bundle symfony4 symfony5

Last synced: about 1 month ago
JSON representation

A simple Symfony bundle to display a cookie law message.

Awesome Lists containing this project

README

        

# Symfony Didublab/CookielawBundle
This is a simple Symfony bundle to display a cookie law message on your **Symfony 4** and **Symfony 5** projects with small setup.

## Install the bundle:
Using composer

```composer
composer require didublab/cookielaw
```

## Render the cookie law:
In your twig, add the twig function where you want to load the cookie consent:

```twig
{{ cookie_law() }}
```

This is the minimum setup, but if you want more, you can configure a few options:

## Configure options:
Create a new config file in your config/packages/ directory, named for example: cookie_law.yaml
This are the available options with the default options:
```yaml
didublab_cookielaw:
cookie_name: cookie-notice-accepted #the cookie name
cookie_value: true #the cookie value
cookie_days: 10 #cookie expiration in days
cookie_readmore_route: false #the route where you want to redirect the users to the "read more" section
```

## Translations
You can translate the text of the cookie law at your needs
- Create inside the translations directory a file called cookielaw.(language).xliff
- Inside add the following content below and change the "target" tag with your translations
```xliff




didublab_cookielaw_cookie_text
This website use cookies. By continuing to browse this website, you declare to accept the use of cookies.


didublab_cookielaw_cookie_accept
Accept


didublab_cookielaw_cookie_readmore
More info


```