定制 w01ki3/cookie-consent 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

w01ki3/cookie-consent

最新稳定版本:v1.1.1

Composer 安装命令:

composer require w01ki3/cookie-consent

包简介

Laravel uygulamaları için KVKK(TR) ve GDPR(AB) uyumlu çerez onay paketi.

README 文档

README

Take control of the cookie policy warning for your Laravel projects with this package.
Record in the database whether the user accepts or rejects the cookie policy.
User activity is recorded along with masked IP address information.
You can customize it.
You can also add different language options. (Currently, Turkish and English are included in the package.)

Installation steps

1. Install the package via Composer:

composer require w01ki3/cookie-consent

2. Publish the package resources

php artisan vendor:publish --provider="w01ki3\CookieConsent\CookieConsentServiceProvider"

3. Create a table to transfer the records to the database.

php artisan migrate

4. If you don't have a csrf token, please add it to the page.

<meta name="csrf-token" content="{{ csrf_token() }}">

5. Add styles in the <head> section:

{!! CookieConsent::styles() !!}

6. Add scripts before closing </body>:

{!! CookieConsent::scripts() !!}

Cookie settings can be managed from the config/cookie-consent.php file

'cookie_categories' => [
    'necessary' => [
        'enabled' => true,
        'locked' => true,
    ],
    'analytics' => [
        'enabled' => env('COOKIE_CONSENT_ANALYTICS', true),
        'locked' => false,
        'js_action' => 'loadGoogleAnalytics',
    ],
    'marketing' => [
        'enabled' => env('COOKIE_CONSENT_MARKETING', true),
        'locked' => false,
        'js_action' => 'loadFacebookPixel',
    ],
    'preferences' => [
        'enabled' => env('COOKIE_CONSENT_PREFERENCES', true),
        'locked' => false,
    ],
]

Then you will see an image like the one below on your screen.
Demo

The recorded log table is as follows:
table name : cookie_consent_logs

id ip_address user_agent action preferences url
bigint varchar(255) text varchar(255) json varchar(255)
1 255.255.255.*** Mozil.... accepted {"analytics": true,"marketing": true,"necessary": true,"preferences": true} www.project.test

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-02