w01ki3/cookie-consent

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

Maintainers

Package info

github.com/w01ki3/cookie-consent

pkg:composer/w01ki3/cookie-consent

Statistics

Installs: 34

Dependents: 0

Suggesters: 0

Stars: 2

v1.1.1 2026-03-12 18:33 UTC

This package is auto-updated.

Last update: 2026-04-12 18:53:41 UTC


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