jeffersongoncalves/laravel-cookie-consent
最新稳定版本:v1.2.0
Composer 安装命令:
composer require 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.
README 文档
README
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.
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 |
|---|---|
![]() | ![]() |
| 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.
统计信息
- 总下载量: 965
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04




