jeffersongoncalves/laravel-cookie-consent

This Laravel package provides a simple and elegant way to implement cookie consent on your website, ensuring compliance with privacy regulations like GDPR and CCPA. It offers a clean and customizable interface, allowing you to easily manage and display cookie consent banners and preferences.

Installs: 1 162

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/jeffersongoncalves/laravel-cookie-consent

v1.2.0 2025-12-27 18:22 UTC

This package is auto-updated.

Last update: 2026-01-05 19:29:54 UTC


README

Laravel Created By

Laravel Cookie Consent

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

This Laravel package provides a simple and elegant way to implement cookie consent on your website, ensuring compliance with privacy regulations like GDPR and CCPA. It offers a clean and customizable interface, allowing you to easily manage and display cookie consent banners and preferences.

Installation

You can install the package via composer:

composer require jeffersongoncalves/laravel-cookie-consent

Usage

Publish config file.

php artisan vendor:publish --tag=cookie-consent-config

Publish views (optional).

php artisan vendor:publish --tag=cookie-consent-views

Publish translations (optional).

php artisan vendor:publish --tag=cookie-consent-translations

Add head template.

@include('cookie-consent::cookie-consent-head')

Add body template.

@include('cookie-consent::cookie-consent-body')

Configuration

You can customize the appearance and behavior of the cookie consent banner by editing the config/cookie-consent.php file.

return [
    'css' => 'https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css',
    'js' => 'https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js',
    'content' => [
        'href' => null,
        'close' => '❌',
    ],
    'palette' => [
        'popup' => [
            'background' => '#696969',
            'text' => '#FFFFFF',
            'link' => '#FFFFFF',
        ],
        'button' => [
            'background' => 'transparent',
            'border' => '#f8e71c',
            'text' => '#f8e71c',
        ],
        'highlight' => [
            'background' => '#f8e71c',
            'border' => '#f8e71c',
            'text' => '#000000',
        ],
    ],
    'position' => 'bottom-left', // top-left, top-right, bottom-left, bottom-right
    'theme' => 'block', // block, edgeless, classic
];

Position

Top Left Top Right
Top Left Top Right
Bottom Left Bottom Right
Bottom Left Bottom Right

Translations

This package supports multiple languages. The following languages are currently available:

  • Arabic (ar)
  • Czech (cs)
  • German (de)
  • English (en)
  • Spanish (es)
  • Persian (fa)
  • French (fr)
  • Hebrew (he)
  • Indonesian (id)
  • Italian (it)
  • Japanese (ja)
  • Dutch (nl)
  • Polish (pl)
  • Portuguese (pt)
  • Portuguese (Brazil) (pt_BR)
  • Portuguese (Portugal) (pt_PT)
  • Slovak (sk)
  • Turkish (tr)

If you want to customize the translations, you can publish the language files:

php artisan vendor:publish --tag=cookie-consent-translations

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

This package uses the Osano CookieConsent plugin.

License

The MIT License (MIT). Please see License File for more information.