PHP code example of fm-labs / cakephp-cookieconsent

1. Go to this page and download the library: Download fm-labs/cakephp-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/ */

    

fm-labs / cakephp-cookieconsent example snippets


// Enable plugin in Application's boostrap method
public function bootstrap() {
    // ... other boootstrap code
    $this->addPlugin('Cookieconsent');
}

// Example layout template

$this->loadHelper('Cookieconsent.Cookieconsent', ['autoRender' => false]);

$this->loadHelper('Cookieconsent.Cookieconsent', [
        'autoRender' => true,
        'block' => 'cookieconsent',
        'palette' => [
            'popup' => ['background' => '#edeff5', 'text' => '#838391'],
            'button' => ['background' => '#4b81e8']
        ],
        'type' => 'info',
        'position' => 'bottom',
        'revokable' => false,
        'autoOpen' => true,
        'law' => ['countryCode' => 'AT', 'regionalLaw' => true],
        'location' => false,
        'content' => [
            'header' => 'Diese Webseite benutzt Cookies.',
            'message' => 'Diese Webseite benutzt Cookies um Ihnen die bestmögliche Nutzung unserer Services zu ermöglichen.',
            'dismiss' => 'Verstanden',
            'link' => 'Datenschutzerklärung',
            'href' => '/datenschutz',
        ],
        'cookie' => [
            'name' => 'cookie_law',
            'path' => '/',
            //'domain' => null,
            'expiryDays' => 365,
        ]
    ]
);