ajaz/cookie-consent-php

A simple PHP cookie consent widget that helps to EU Cookie Law

v1.0 2020-11-14 11:05 UTC

This package is auto-updated.

Last update: 2025-05-15 01:27:04 UTC


README

PHP Cookie Consent Widget

Installation Guide

composer require ajaz/cookie-consent-php

ajaz/cookie-consent-php

How to use (Below PHP code should be apply in Head section)

use Ajaz\CookieConsent\Widget;

require 'vendor/autoload.php';

<?php echo Widget::run([
	'websiteName'=>'Your website name',
	'noticeBannerType'=> Widget::INTERSTITIAL_NOTICE_BANNER,
	'consentType'=> Widget::EXPRESS,
	'palette'=> Widget::DARK_SKIN,
	'cookiesPolicyUrl'=> 'http://www.example.com/cookie-policy',
]); ?>

Configuration Options

option description default type
websiteName Your website name Required STRING
noticeBannerType Define the cookie consent popup style Options Widget::INTERSTITIAL_NOTICE_BANNER, Widget::SIMPLE_NOTICE_BANNER, Widget::HEADLINE_NOTICE_BANNER, Widget::STANDALONE_NOTICE_BANNER Widget::INTERSTITIAL_NOTICE_BANNER STRING
consentType Defines the cookie consent popup text style Widget::EXPRESS STRING
palette Cookie consent popup theme style by default dark skin for light skin Widget::LIGHT_SKIN Widget::DARK_SKIN STRING
language Cookie consent popup default language pass language code example en,fr Widget::LANG_EN STRING
cookiesPolicyUrl Your website cookie policy page url Required STRING

Worth knowing

Widgets throws an InvalidArgumentException if you define an invalid property in Widget::run() method