PHPackages                             fet/laravel-cookie-consent - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fet/laravel-cookie-consent

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fet/laravel-cookie-consent
==========================

A simple Laravel wrapper around the orestbida/cookieconsent package.

0.4.0(1y ago)1846MITPHPPHP ^8.1

Since Aug 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/f-E-T/laravel-cookie-consent)[ Packagist](https://packagist.org/packages/fet/laravel-cookie-consent)[ Docs](https://github.com/f-e-t/laravel-cookie-consent)[ RSS](/packages/fet-laravel-cookie-consent/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (7)Versions (6)Used By (0)

Introduction
============

[](#introduction)

The `fet/laravel-cookie-consent` package is a simple Laravel wrapper around the [orestbida/cookieconsent](https://github.com/orestbida/cookieconsent) package.

Installation
============

[](#installation)

1. `composer require fet/laravel-cookie-consent`
2. `php artisan vendor:publish --provider="Fet\CookieConsent\CookieConsentServiceProvider" --tag="config"`

Configuration
=============

[](#configuration)

```
// config/cookieconsent.php

return [
    'enable' => true,
    'routes' => [
        'post' => '',
        'redirect' => '',
    ],
    'paths' => [
        'exclude' => []
    ],
    'config' => [],
];
```

The configuration consists of four keys: `enable`, `routes`, `paths` and `config`. The `config` value is an array representation of the [Configuration](https://cookieconsent.orestbida.com/reference/configuration-reference.html) object and is passed to the [CookieConsent](https://github.com/orestbida/cookieconsent) package as JSON. Feel free to configure the package as you like.

POST Route
----------

[](#post-route)

The [Callback/Events](https://cookieconsent.orestbida.com/advanced/callbacks-events.html) are not directly configurable. Instead you can define a `routes.post` which corresponds to an existing route name which is then called via POST request when the events `onFirstConsent` or `onChange` are triggered.

> If the `routes.post` is empty, no POST request is sent.

The data received by the controller looks like this:

```
{
    "consentId": "xxx",
    "acceptType": "all",
    "acceptedCategories": [
        "necessary",
        "analytics"
    ],
    "rejectedCategories": [],
    "custom": {}
}
```

Redirect Route
--------------

[](#redirect-route)

If you want to perform a page redirect after the user has made the cookie consent choice, you can provide a route name to `routes.redirect`.

> If the `routes.redirect` is empty, no redirect is made.

Exclude Paths
-------------

[](#exclude-paths)

To exclude the cookie consent from appearing on certain URL paths, add those paths to the `paths.exclude` configuration array.

> You can use valid regex patterns. For example, to exclude all `/admin/*` paths, add `admin(\/.*)?` to the exclude array.

Events
======

[](#events)

Sometimes you may need to change the configuration, after the application is booted. You can do so by listening to the `\Fet\CookieConsent\Events\ConfigLoaded` event.

```
use Fet\CookieConsent\Events\ConfigLoaded;

Event::listen(function (ConfigLoaded $event) {
    $config = $event->cookieConsent->config;

    // make changes to the $config array

    $event->cookieConsent->config = $config;
});
```

Custom POST data
----------------

[](#custom-post-data)

To include custom data in the POST request, set the `custom` key in the configuration. This data will be sent alongside the consent information.

```
$config['custom'] = ['foo' => 'bar'];
```

Tests
=====

[](#tests)

Run the tests with:

```
composer test
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance49

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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 ~78 days

Total

5

Last Release

378d ago

PHP version history (2 changes)0.1.0PHP ^8.1|^8.2|^8.3

0.3.1PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/87535893?v=4)[Marc Schulthess](/maintainers/f-E-T)[@f-E-T](https://github.com/f-E-T)

---

Top Contributors

[![f-E-T](https://avatars.githubusercontent.com/u/87535893?v=4)](https://github.com/f-E-T "f-E-T (7 commits)")

---

Tags

cookie-consentgdprlaravellaravelgdprcookie-consent

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M10](/packages/renatomarinho-laravel-page-speed)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[atlas-php/atlas

A unified AI SDK for Laravel applications.

5345.4k](/packages/atlas-php-atlas)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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