Download the PHP package numero2/contao-cookie-consent without Composer

On this page you can find all versions of the php package numero2/contao-cookie-consent. 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 contao-cookie-consent

Contao Cookie Consent Bundle

Packagist Version License: LGPL v3

A cookie consent solution for Contao CMS - the drop-in replacement for the cookie consent functionality of Contao Marketing Suite.


Screenshot

Cookie Consent in Light and Dark mode


Requirements


Installation

Via Contao Manager or Composer:


Insert Tags

Use these insert tags directly in your Contao templates and content elements to control cookie consent dependent output.

Tag Description
{{cc_optinlink}} Renders a link that reopens the cookie consent dialog, allowing the user to adjust their consent. After confirming, the page scrolls back to the original element automatically.
{{ifoptin::*}} Wraps content that is only shown if the user has accepted the specified tag. Replace * with the tag ID.
{{ifnoptin::*}} Wraps content that is only shown if the user has not accepted the specified tag. Replace * with the tag ID.

Examples


Styling

Colors

Colors can be customized via CSS custom properties. Example:

A full list of available CSS custom properties can be found in contao/templates/styles/cc_default.html.twig.

Customizing both dialogs at once

The consent dialog and the opt-in fallback share the base template styles/cc_default.html.twig. Override it in your installation to change custom properties or add CSS that applies to both of them:

custom_styles is rendered after the CSS of the individual dialogs, so its rules win over the defaults of the bundle without needing !important.

Do not use {% block styles %} here - that block is reserved for the individual dialogs (styles/cc_cookie_consent.html.twig and styles/cc_cookie_optin.html.twig) and would be overwritten by them.

Customizing a single dialog

To style only one of the two, override the corresponding template and keep the defaults via parent():

Color scheme

By default, both elements follow the color scheme defined by the user's operating system or browser. If your page layout requires a specific scheme, it can be enforced via a custom template:


Developer API

This bundle exposes helper utilities to check cookie consent status programmatically - both in PHP/Symfony and in Twig templates.

PHP / Symfony

Inject the numero2_cookie_consent.util.cookie_consent service into your controller or service:

Twig

Three global Twig functions are available:

HTTP-Cache

Should work as expected for other Contao entities such as content elements, modules, articles, pages, etc. This means that whenever a tag or tag group is created, edited, or deleted, the corresponding cache entries will be invalidated.

However, be aware that we do not support cache invalidation based on function usage, e.g. $this->cookieConsentUtil->isTagAccepted(<id>), or in Twig {% if cc_tag_not_accepted(<id>) %}. Also, the insert tag {{ifoptin::<id>}} can only affect the rendered markup based on the tag configuration itself.


Disclaimer

Cookie storage

This bundle manages cookie consent on behalf of your Contao installation. Any cookies set during the consent process belong to your website - no data is transmitted to or stored by us.

The following cookies are set by this bundle:

Cookie Value Lifetime Purpose
cc_cookies List of tag group IDs 7 days by default, configurable Stores which tag groups the user has accepted (if any).

Consent Logs

This bundle does not maintain any server-side logs of individual user consent. As the extension does not require user accounts, it is technically impractical to link a consent decision to a specific individual or IP address. Instead, user consent - or rejection - is recorded exclusively via a cookie stored on the user’s device. This approach ensures that consent can be reliably verified for each user while avoiding the storage of personal data on the server, in line with GDPR principles of data minimization and privacy by design.

Legal stuff

Please use this bundle at your own risk. Whether your specific setup is legally compliant is something we cannot assess - if you're uncertain, a lawyer is the right contact. For technical questions, though, we're happy to help.


All versions of contao-cookie-consent with dependencies

PHP Build Version
Package Version
Requires contao/core-bundle Version ^5.7 || ^6.0
jeremykendall/php-domain-parser Version ^6.4
doctrine/dbal Version ^3.7 || ^4.3
symfony/config Version ^7.4 || ^8.0
symfony/dependency-injection Version ^7.4 || ^8.0
symfony/event-dispatcher Version ^7.4 || ^8.0
symfony/http-foundation Version ^7.4 || ^8.0
symfony/http-kernel Version ^7.4 || ^8.0
symfony/translation-contracts Version ^3.0
twig/twig Version ^3.21
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 numero2/contao-cookie-consent contains the following files

Loading the files please wait ...