Download the PHP package datashop/contao-cookiebar-bridge without Composer

On this page you can find all versions of the php package datashop/contao-cookiebar-bridge. 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-cookiebar-bridge

Contao Cookiebar Bridge

Ergänzt oveleon/contao-cookiebar um zwei Dinge, die es dort nicht gibt:

  1. Serverseitige Zustimmungsabfragen in Twig-Templates und InsertTags (analog zu is_tag_accepted() bei numero2/contao-cookie-consent).
  2. Eine generische Sichtbarkeits-Option für beliebige Content-Elemente und Frontend-Module: "nur anzeigen, wenn Cookie X akzeptiert/nicht akzeptiert wurde".

Warum das nicht trivial ist

Die Cookiebar speichert den Zustimmungsstatus ausschließlich im localStorage des Browsers - serverseitig (PHP/Twig) ist davon nichts bekannt. Diese Bridge spiegelt den Zustand deshalb per JavaScript in einen echten HTTP-Cookie (ccb_bridge_consent), den PHP lesen kann.

Das hat einen Preis: Seiten, die den Zustand tatsächlich abfragen, sind personalisiert und dürfen nicht per Full-Page-Cache/Reverse-Proxy geteilt werden. Sobald in einem Request eine Zustimmungsabfrage ausgewertet wird, setzt der ResponseCacheGuardListener automatisch Cache-Control: private, no-store. Seiten ohne solche Abfragen bleiben normal cachebar.

Installation

Danach: Contao Manager "Datenbank aktualisieren" ausführen (neue Felder in tl_content/tl_module) und bin/console assets:install (bzw. Contao Manager macht das automatisch).

public/cookiebar-bridge.js und public/cookiebar-bridge.css werden automatisch auf jeder Frontend-Seite eingebunden (per AssetInjectionListener) - kein manueller Schritt im Seitenlayout nötig. Das wäre über den Datei-Picker im Layout ohnehin nicht möglich, da Assets aus public/-Ordnern von Composer-Paketen außerhalb von Contaos Dateibaum (tl_files) liegen.

1. Twig-Funktionen

3 ist dabei die ID des tl_cookie-Datensatzes (nicht der Cookie-Gruppe).

2. InsertTags

Nutzbar im HTML-Editor oder in mediumtext-Feldern mit Contaos eingebauter Wenn-Dann-Logik:

Es gibt außerdem {{cookiebar_not_accepted::3}} als Kurzform.

3. Sichtbarkeits-Option für Content-Elemente & Module

Jedes Content-Element und jedes Frontend-Modul bekommt im Bereich "Sichtbarkeit" (analog zum bestehenden "Zugriff geschützt") eine neue Checkbox "Anzeigen nach Cookie-Zustimmung". Ist sie aktiviert, erscheinen direkt darunter:

Der Platzhaltertext läuft durch Contaos InsertTag-Parser - {{cookiebar::show::Datenschutz}} (Link zum erneuten Öffnen der Cookiebar) funktioniert also direkt darin. Er wird in einen <div class="ccb-bridge-fallback"> gehüllt, dafür liefert public/cookiebar-bridge.css eine minimale Basis-Optik (heller roter Hintergrund, rote Schrift) - eigenes CSS überschreibt das problemlos.

Der Hook (getContentElement/getFrontendModule) greift auf den fertig gerenderten HTML-String, unabhängig davon ob das Element mit Twig oder einem klassischen .html5-Template gerendert wurde.

Sicherheitshinweis

Der ccb_bridge_consent-Cookie ist eine reine Momentaufnahme des localStorage. Wie jeder client-gesetzte Consent-Wert (auch bei numero2 und der Cookiebar selbst) kann er theoretisch manipuliert werden. Für echte Zugriffskontrolle (z.B. bezahlte Inhalte) ist das nicht geeignet - für die übliche Aufgabe "Drittinhalt nur nach Einwilligung laden" ist dieses Vertrauensmodell branchenüblich.

Architekturentscheidungen


All versions of contao-cookiebar-bridge with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
contao/core-bundle Version ^5.3
oveleon/contao-cookiebar Version ^2.0
symfony/asset Version ^6.4 || ^7.0
symfony/http-foundation Version ^6.4 || ^7.0
symfony/http-kernel Version ^6.4 || ^7.0
symfony/dependency-injection Version ^6.4 || ^7.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 datashop/contao-cookiebar-bridge contains the following files

Loading the files please wait ...