PHPackages                             code16/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. code16/cookie-consent

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

code16/cookie-consent
=====================

Cookie consent bar &amp; manage modal

v1.6.0(2y ago)16.5kPHPPHP ^8.0|^8.1|^8.2|^8.3

Since Feb 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/code16/cookie-consent)[ Packagist](https://packagist.org/packages/code16/cookie-consent)[ RSS](/packages/code16-cookie-consent/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (7)Versions (17)Used By (0)

Cookie consent
==============

[](#cookie-consent)

Setup
-----

[](#setup)

```
composer require code16/cookie-consent
```

**Required**: publish assets (add this in composer.json `post-autoload-dump` scripts)

```
php artisan vendor:publish --provider='Code16\CookieConsent\CookieConsentServiceProvider' --tag=assets --force
```

You may publish the config file:

```
php artisan vendor:publish --provider="Code16\CookieConsent\CookieConsentServiceProvider" --tag=config
```

And the lang file:

```
php artisan vendor:publish --provider="Code16\CookieConsent\CookieConsentServiceProvider" --tag=lang
```

Usage
-----

[](#usage)

### Default

[](#default)

In your blade layout

```

    {{-- ... --}}
    @cookies

          {{-- some injected cookies --}}

    @endcookies

    {{-- end of the body --}}
    @include('cookieConsent::index')

```

### With category

[](#with-category)

To let the user manage multiple cookie categories (e.g. analytics, socials) Add the category key to the `@cookies` directive

```

    {{-- ... --}}

    @cookies('analytics')

          {{-- some analytics script --}}

    @endcookies

```

Also you must declare the cookie category in `config/cookie-consent.php` as follow

```
[
    'cookie_categories' => [
        'system' => [
            'required' => true,
        ],
        'analytics' => [],
    ]
];
```

Categories marked as `required` are cannot be opt-out by the user.

To provide explanation texts in the manage dialog, add content to the lang file:

```
[
    'manage' => [
        'title' => 'Manage cookies',
        'description' => 'About cookies...',
        'categories' => [
            'system' => [
                'title' => 'System cookies',
                'description' => "Description text about system cookies",
            ],
            'analytics' => [
                'title' => 'Analytics cookies',
                'description' => "Description text about analytics cookies",
            ],
        ],
    ]
];
```

### Show the manage modal from a link (e.g. cookies page)

[](#show-the-manage-modal-from-a-link-eg-cookies-page)

In the page:

```
    @section('content')
        Open manage cookies modal
    @endsection
```

### Intercept accept POST request

[](#intercept-accept-post-request)

If you need to add some custom logic when cookies are accepted (meaning: either when the used clicked on OK in the Bar or after setting his choices on the Modal), you can define a Middleware in the cookie-consent-middleware config key, which will be executed on the POST request.

Example:

```
    // in config/cookie-consent.php
    return [
        // ...
        'middleware' => 'cookie-consent.accepted'
    ];
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 53.8% 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 ~138 days

Recently: every ~244 days

Total

12

Last Release

763d ago

Major Versions

v1.2.0 → v2.0.0-alpha.12021-08-12

PHP version history (6 changes)1.0.0PHP ^7.2

v1.2.0PHP &gt;=7.3

v2.0.0-alpha.2PHP ^7.4|^8.0

v1.3.0PHP ^8.0|^8.1

v1.4.0PHP ^8.0|^8.1|^8.2

v1.6.0PHP ^8.0|^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/f97dcdc942d25d5b5720b790d5f28e6accc6f05370cf5a6b52b78abc60c29e57?d=identicon)[code16](/maintainers/code16)

---

Top Contributors

[![dvlpp](https://avatars.githubusercontent.com/u/973325?v=4)](https://github.com/dvlpp "dvlpp (7 commits)")[![PierreBillaud](https://avatars.githubusercontent.com/u/43741101?v=4)](https://github.com/PierreBillaud "PierreBillaud (3 commits)")[![smknstd](https://avatars.githubusercontent.com/u/2412608?v=4)](https://github.com/smknstd "smknstd (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[cknow/laravel-money

Laravel Money

1.0k4.3M22](/packages/cknow-laravel-money)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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