Download the PHP package fatalnetwork/symfony-cookie-consent-bundle without Composer

On this page you can find all versions of the php package fatalnetwork/symfony-cookie-consent-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony-cookie-consent-bundle

Cookie Consent bundle for Symfony

Symfony bundle to append Cookie Consent to your website to comply to AVG/GDPR for cookies. This bundle is tested for Symfony 5. The style works with Bootstrap 5.

Installation

Step 1: Download packages

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

In a Symfony application run this command to install Bootstrap in your application

Step 2: Configuration

/config/bundles.php

Include the bundle to your project

/config/packages/fn_cookie_consent.yaml

Configure your Cookie Consent with the following possible settings

/config/routes/fn_cookie_consent.yaml

When not using symfony flex, enable the bundles routing manually

Step 3: Assets

Bootstrap Style

When enabled SassLoader in your webpack.config.js add the scss file from bootstrap to your project

Stimulus Controller

Copy the stimulus controller from Resources/assets/controllers/cookie_consent_modal_controller.js to your controllers folder inside your application (usually /assets/controllers/cookie_consent_modal_controller.js)

JS and CSS rebuild

When you set new js oder style (css or scss) files you have to make a rebuild of your public assets

Step 4: Database

When using logger you have to make a migration file

After that you can migrate the changes

Usage

Twig implementation

Load the cookie consent in Twig via render_esi ( to prevent caching ) at any place you like

If you want to load the cookie consent with a specific locale you can pass the locale as a parameter

Instead of using render_esi() you can use the render() function

Stimulus implementation

The stimulus controller needs to implement eg. base.html.twig, make sure the modal is inner this controller

You can set more links for opening the modal like this

Cookies

When a user submits the form the preferences are saved as cookies. The cookies have a lifetime of 1 year. The following cookies are saved

Logging

AVG/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.

Log

Themes

View

TwigExtension

The following TwigExtension functions are available

fncookieconsent_isCategoryAllowedByUser check if user has given it's permission for certain cookie categories (return bool)

fncookieconsent_isCookieConsentSavedByUser check if user has saved any cookie preferences (return bool)

fncookieconsent_isCookieConsentOpenByDefault check if the modal view has to open for the user (return string)

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 FNCookieConsentBundle translation files. Use the privacy_route variable inside language files to define the definied route names inside your controller.

Styling

FNCookieConsentBundle comes without an own styling, it is styled from bootstrap. 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 for customization. Each element has a unique class name, so you can change everything.

Option SASS

Copy the file Resources/assets/css/cookie_consent.scss into your project style folder, eg. /assets/styles/cookie_consent.scss and include this scss file into your /assets/styles/app.scss

Option CSS

Include the stylesheet in your template, eg. /templates/base.html.twig

Javascript

By loading Resources/public/js/cookie_consent.js the cookie consent will be submitted via ajax.

Events

When 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.

Template Themes

You can override the templates by placing templates inside your project (except for Symfony 5 projects):

Template override for Symfony 5 projects

You 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/FNCookieConsentBundle/" .


All versions of symfony-cookie-consent-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
doctrine/annotations Version ^1.6
doctrine/doctrine-bundle Version ^1.10 || ^2.0
doctrine/orm Version ^2.5
symfony/asset Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/dependency-injection Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/doctrine-bridge Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/expression-language Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/form Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/framework-bundle Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/http-foundation Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/templating Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/translation Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/twig-bridge Version ^3.4 || ^4.2 || ^5.0 || ^6.0
symfony/twig-bundle Version ^3.4 || ^4.2 || ^5.0 || ^6.0
twig/twig Version ^2.6 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fatalnetwork/symfony-cookie-consent-bundle contains the following files

Loading the files please wait ....