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(10mo ago)1606MITPHPPHP ^8.1

Since Aug 13Pushed 10mo 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 1mo ago

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 72% of packages

Maintenance53

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

324d ago

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

0.3.1PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc87555460306e35d17c3ede6ec071a207ba15d59d340a71380fb74b871ad659?d=identicon)[f-E-T](/maintainers/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

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)[ringierimu/state-workflow

Laravel State Workflow provide tools for defining and managing workflows and activities with ease.

3251.1k](/packages/ringierimu-state-workflow)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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