PHPackages                             ideacatlab/laravel-cookie-consent-enhanced - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. ideacatlab/laravel-cookie-consent-enhanced

ActiveLibrary[Security](/categories/security)

ideacatlab/laravel-cookie-consent-enhanced
==========================================

Make your Laravel app comply with the EU cookie law and implement a cookie control system that allows users to manage their own cookie preferences

v0.0.14(2y ago)2148MITPHPPHP ^8.2

Since Dec 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ideacatlab/laravel-cookie-consent-enhanced)[ Packagist](https://packagist.org/packages/ideacatlab/laravel-cookie-consent-enhanced)[ Docs](https://github.com/ideacatlab/laravel-cookie-consent-enhanced)[ Fund](https://opencollective.com/ideacat)[ RSS](/packages/ideacatlab-laravel-cookie-consent-enhanced/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (7)Versions (14)Used By (0)

[![](https://raw.githubusercontent.com/ideacatlab/laravel-cookie-consent-enhanced/master/.github/images/github-cookie-consent-logo.png)](https://ideacat.ro)

Elevate Your Laravel App's GDPR Compliance with Enhanced Cookie Consent
=======================================================================

[](#elevate-your-laravel-apps-gdpr-compliance-with-enhanced-cookie-consent)

Ensuring compliance with EU laws on cookie usage is crucial for websites targeting or owned by EU citizens. Dive into the capabilities of this Laravel package, a robust extension originating from [Spatie's Laravel Cookie Consent](https://github.com/spatie/laravel-cookie-consent). Developed by IdeaCat, a web development agency in Bucharest, Romania, this package not only simplifies the implementation of a cookie consent dialog but also extends its functionalities. Beyond the essentials, it introduces advanced features like predefined database tables, administrative tools for user data management, and seamless integration of GDPR compliance requirements.

Explore further details about the EU legislation on cookies [here](http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm#section_2).

Installation and Configuration
------------------------------

[](#installation-and-configuration)

### 1. Install the Package

[](#1-install-the-package)

You can effortlessly install the package via Composer. Open your terminal and run:

```
composer require ideacatlab/laravel-cookie-consent-enhanced
```

The package will automatically register itself in your Laravel application.

### 2. Publish Vendor Files

[](#2-publish-vendor-files)

Run the publish command to publish the views, languages, database migration, config and assets.

```
php artisan vendor:publish --provider="Ideacatlab\LaravelCookieConsentEnhanced\CookieConsentServiceProvider"
```

### 3. Migrate the Database

[](#3-migrate-the-database)

Execute the migration command to create the required database tables:

```
php artisan migrate
```

### Configuration Details

[](#configuration-details)

Upon publishing the configuration file, you'll find a file named `cookie-consent-enhanced.php` in the `config` directory. Here's an overview of the configuration options:

```
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,
];
```

### Note on Cookie Domain

[](#note-on-cookie-domain)

Ensure you set the cookie domain by using the 'domain' key in the `config/session.php` file. Add the corresponding value in your `.env` file for `SESSION_DOMAIN`. If your URL includes a port, such as 'localhost:3000', it is crucial to set this value for the package to function correctly.

Usage and Customization
-----------------------

[](#usage-and-customization)

### Displaying the Cookie Consent Dialog Using Blade Template

[](#displaying-the-cookie-consent-dialog-using-blade-template)

To effortlessly display the cookie consent dialog in your template, include the following line in your Blade file:

```
@include('cookie-consent-enhanced::index')
```

This will render a dialog similar to the one depicted below. Note that the default styling, powered by TailwindCSS v2, creates a floating banner at the bottom of the page.

### Displaying the Cookie Consent Dialog Using the Middleware

[](#displaying-the-cookie-consent-dialog-using-the-middleware)

Instead of manually including `cookie-consent-enhanced::index` in your view, consider adding the middleware to your kernel:

```
// app/Http/Kernel.php

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

    // ...
}
```

This will automatically add `cookie-consent-enhanced::index` to your response just before the closing body tag.

[![Cookie Consent Dialog](https://raw.githubusercontent.com/ideacatlab/laravel-cookie-consent-enhanced/master/.github/images/dialog.png)](https://raw.githubusercontent.com/ideacatlab/laravel-cookie-consent-enhanced/master/.github/images/dialog.png)

Upon clicking "Allow cookies," a `cookie_consent` cookie will be set, and the dialog will be removed from the DOM. Laravel, recognizing the set `laravel_cookie_consent` cookie on subsequent requests, will refrain from displaying the dialog again.

### Customizing Dialog Texts

[](#customizing-dialog-texts)

The files is published to `resources/lang/vendor/cookie-consent-enhanced/en/texts.php`. You can then customize the text as follows:

```
return [
    'message' => 'Please be informed that this site uses cookies.',
    'agree' => 'Allow cookies',
];
```

For translations, copy the file to, for instance, `resources/lang/vendor/cookie-consent-enhanced/fr/texts.php` and provide the French translations.

### Customizing Dialog Contents

[](#customizing-dialog-contents)

The files is published to the `index` and `dialogContents` view files to `resources/views/vendor/cookie-consent-enhanced`. Typically, you only need to modify the `dialogContents` view. Adjusting the JavaScript code is possible in the `index` view file.

Testing
-------

[](#testing)

Execute the following command to run tests:

```
composer test
```

Security
--------

[](#security)

If you discover any security-related issues, please contact  instead of using the issue tracker.

License
-------

[](#license)

This project is licensed under the MIT License. See [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

13

Last Release

930d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/71712824?v=4)[Răzvan Gheorghe](/maintainers/ideacatlab)[@ideacatlab](https://github.com/ideacatlab)

---

Top Contributors

[![ideacatlab](https://avatars.githubusercontent.com/u/71712824?v=4)](https://github.com/ideacatlab "ideacatlab (38 commits)")

---

Tags

cookiecookiesgdprlaravelcookiecookie-consenteulawcomplyEnhancedideacatlabideacatcookie-consent-enhanced

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/ideacatlab-laravel-cookie-consent-enhanced/health.svg)

```
[![Health](https://phpackages.com/badges/ideacatlab-laravel-cookie-consent-enhanced/health.svg)](https://phpackages.com/packages/ideacatlab-laravel-cookie-consent-enhanced)
```

###  Alternatives

[spatie/laravel-cookie-consent

Make your Laravel app comply with the crazy EU cookie law

1.5k5.0M25](/packages/spatie-laravel-cookie-consent)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[moonshine/moonshine

Laravel administration panel

1.3k253.1k80](/packages/moonshine-moonshine)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725173.6k14](/packages/tallstackui-tallstackui)[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
