PHP code example of ideacatlab / laravel-cookie-consent-enhanced

1. Go to this page and download the library: Download ideacatlab/laravel-cookie-consent-enhanced 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/ */

    

ideacatlab / laravel-cookie-consent-enhanced example snippets


return [

    /*
     * Use this setting to enable the cookie consent dialog.
     */
    'enabled' => env('COOKIE_CONSENT_ENABLED', true),

    /*
     * The name of the cookie in which we store if the user
     * has agreed to accept the conditions.
     */
    'cookie_name' => 'cookie_consent',

    /*
     * Set the cookie duration in days. Default is 365 * 20.
     */
    'cookie_lifetime' => 365 * 20,
];

// app/Http/Kernel.php

class Kernel extends HttpKernel
{
    protected $middleware = [
        // ...
        \Ideacatlab\LaravelCookieConsentEnhanced\CookieConsentMiddleware::class,
    ];

    // ...
}

return [
    'message' => 'Please be informed that this site uses cookies.',
    'agree' => 'Allow cookies',
];
sh
php artisan vendor:publish --provider="Ideacatlab\LaravelCookieConsentEnhanced\CookieConsentServiceProvider"
bash
php artisan migrate