PHPackages                             coercive/cookieconsent - 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. coercive/cookieconsent

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

coercive/cookieconsent
======================

Coercive CookieConsent is a micropackage (css, js, php) to easily manage user consent at the cookie level of a site.

0.0.3(11mo ago)090MITPHP &gt;=7.4

Since Oct 20Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/Coercive/CookieConsent)[ Packagist](https://packagist.org/packages/coercive/cookieconsent)[ Docs](http://coercive.fr)[ RSS](/packages/coercive-cookieconsent/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

CookieConsent
=============

[](#cookieconsent)

CookieConsent is a micropackage (css, js, php) to easily manage user consent at the cookie level of a site.

How to configure popup
======================

[](#how-to-configure-popup)

```
{
    "settings":
    {
        "lang": "EN",
        "name": "cookieconsent",
        "accept": "ALL",
        "decline": "NONE",
        "accept_duration": 365,
        "decline_duration": 365,
        "configure_duration": 365
    },
    "popup":
    {
        "title": "Configure cookies",
        "description": "Hello! This is an example of text description in cookie popup.",
        "btn_decline": "Decline",
        "btn_configure": "Configure",
        "btn_accept": "Accept"
    },
    "configure":
    {
        "title": "Configure each cookie",
        "description": "",
        "btn_back": "Back",
        "btn_save": "Save selection",
        "options":
        {
            "SYSTEM":
            {
                "id": "SYSTEM",
                "disabled": true,
                "title": "System cookies",
                "description": "System cookies essential for the proper functioning of the site."
            },
            "GOOGLE_ANALYTICS":
            {
                "id": "GOOGLE_ANALYTICS",
                "disabled": false,
                "checked": true,
                "title": "Google Analytics",
                "description": "Example of description text."
            },
            "FACEBOOK":
            {
                "id": "FACEBOOK",
                "disabled": false,
                "checked": false,
                "title": "Facebook",
                "description": "Example of description text."
            },
            "YOUTUBE":
            {
                "id": "YOUTUBE",
                "disabled": false,
                "checked": false,
                "title": "YouTube",
                "description": "Example of description text."
            }
        }
    }
}
```

**Settings**

- settings.lang : the website current language *(for customize CSS with)*
- settings.name : the name of config cookie
- settings.accept : the value for "accept all"
- settings.decline : the value for "decline all"
- settings...\_duration : different durations for setted cookie for each choice

etc...

JS requires
===========

[](#js-requires)

The example JS file require some externals scripts :

- JavaScript Cookie v2.2.1
- jQuery v2.1.4

Start JS (basic example)
========================

[](#start-js-basic-example)

```
require('./plugin/CookieConsent');

new CookieConsent(json_data).load();
```

Ask for consent again
=====================

[](#ask-for-consent-again)

Example of a new request for consent at the cookie level, if for example certain content is inaccessible as such and you want to offer the user to reconsider his choice.

```
var $reConsentPopup = $('.cookieconsent-reload-popup');
if($reConsentPopup.length) {
    $reConsentPopup.click(function (event) {
        event.preventDefault();
        event.stopPropagation();
        new CookieConsent(json_data, {reload: true}).start();
    })
}
```

Configure CSS
=============

[](#configure-css)

You can copy and rewrite partialy the css file, or just declare some variables.

```
// Color of accept button
$cookieconsent-color-btn-accept: 'red';

// Color for switch checkbox (checked)
$switcheckbox-color-checked: 'red';

// Font title
%cookieconsent-font-title {
    font-family: something;
    // you can add extra styles
}
// Font text
%cookieconsent-font-text {
    font-family: something;
    // you can add extra styles
}
// Font button
%cookieconsent-font-btn {
    font-family: something;
    // you can add extra styles
}
```

Customize CSS for current language on main container.

```
#CookieConsentPopup[data-lang="FR"] { /* do something */ }
```

Customize CSS for each popup. *(main, or configure)*.

```
.ccard[data-service="cookies"] {}
.ccard[data-service="cookies-configure"] {}
```

Add background layout when popup is opened.

```
body {
    &.CookieConsentPopupOpened {
        overflow: hidden;
        &:before {
            content: '';
            position: fixed;
            display: block;
            width: 100%;
            height: 100%;
            background: rgba(255, 255, 255, .75);
            z-index: 100;
        }
    }
}
```

Picture
=======

[](#picture)

The given cookie image in /dist/img/cookie.png is free of use.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance52

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Total

4

Last Release

331d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20288080?v=4)[Coercive](/maintainers/Coercive)[@Coercive](https://github.com/Coercive)

---

Top Contributors

[![Coercive](https://avatars.githubusercontent.com/u/20288080?v=4)](https://github.com/Coercive "Coercive (18 commits)")

### Embed Badge

![Health badge](/badges/coercive-cookieconsent/health.svg)

```
[![Health](https://phpackages.com/badges/coercive-cookieconsent/health.svg)](https://phpackages.com/packages/coercive-cookieconsent)
```

PHPackages © 2026

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