PHP code example of easyrider7522 / yii2-cookieconsent

1. Go to this page and download the library: Download easyrider7522/yii2-cookieconsent library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

easyrider7522 / yii2-cookieconsent example snippets



use easyrider7522\cookieconsent\CookieConsent;

CookieConsent::widget([
    'lang'      => 'en',
    'options'   => [
        'palette'   => [
            'popup'     => [
                'background'    => '#222',
                'text'          => '#fff',
            ],
            'button'    => [
                'background'    => '#459f45',
                'text'          => '#fff',
            ],
        ],
        'theme'     => 'classic',
        'position'  => 'top',
        'type'      => 'opt-in',
        'content'   => [
            'message'   => 'This website uses cookies to ensure you get the best experience on our website.',
            'dismiss'   => 'Got it!',
            'link'      => 'Learn more',
            'href'      => 'http://cookiesandyou.com/',
        ],
    ],
]);

CookieConsent::widget([
    'optionsJs' => '{
        "palette": {
            "popup": {
                "background": "#000"
            },
            "button": {
                "background": "#f1d600"
            }
        },
        "position": "top"
    }',
]);