sy/cookieconsent

Cookie consent web component

2.0.0 2022-10-16 20:42 UTC

This package is auto-updated.

Last update: 2024-10-17 01:24:53 UTC


README

A javascript component for for alerting users about the use of cookies on your website

Installation

Install the latest version with

$ composer require sy/cookieconsent

Basic Usage

<?php

use Sy\Component\Html\Page;
use Sy\Component\Web\CookieConsent;

$popup = new CookieConsent();

$page = new Page();

$page->addBody($popup);

echo $page;

Output:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css" />
<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" defer></script>
</head>
<body>
<script type="module">
(function() {
	window.cookieconsent.initialise({"palette":{"popup":{"background":"#252e39"},"button":{"background":"#14a7d0"}}});
})();</script>
</body>
</html>