PHPackages                             dutchheight/craft-cookie-boss - 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. dutchheight/craft-cookie-boss

ActiveCraft-plugin

dutchheight/craft-cookie-boss
=============================

Allow your visitors to set their cookie preference.

1.4.4(4y ago)32.2k1[4 PRs](https://github.com/dutchheight/craft-cookie-boss/pulls)proprietaryPHP

Since Sep 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dutchheight/craft-cookie-boss)[ Packagist](https://packagist.org/packages/dutchheight/craft-cookie-boss)[ RSS](/packages/dutchheight-craft-cookie-boss/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (1)Versions (24)Used By (0)

[![Screenshot](resources/img/plugin-logo.png)](resources/img/plugin-logo.png)

Craft Cookie boss plugin for Craft CMS 3.x
==========================================

[](#craft-cookie-boss-plugin-for-craft-cms-3x)

Allow your visitors to set their cookie preference which you can use to enable features in your site. Create your own cookie groups, make them required and/or set their default state. These cookie groups can contain cookies with information which you can display to describe the purpose of each cookie.

[![Create own cookie groups](resources/img/consent-groups.png)](resources/img/consent-groups.png)[![Add cookies to cookie groups](resources/img/cookie-descriptions.png)](resources/img/cookie-descriptions.png)

The default modal contains the following features:

- Default responsive modal
- Position (top-left, top-right, bottom-left, bottom-right)
- Auto accept and close after x seconds (optional)
- Block site usage without consent
- Display settings (yes/no)

Modal with settings:

[![Modal with settings](resources/img/modal-with-settings.png)](resources/img/modal-with-settings.png)

Modal settings:

[![Modal without settings](resources/img/modal-settings.png)](resources/img/modal-settings.png)

Modal without settings:

[![Modal without settings](resources/img/modal-without-settings.png)](resources/img/modal-without-settings.png)

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0 or later.

Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require dutchheight/craft-cookie-boss

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Craft Cookie boss.
4. Add `{{ craft.cookieBoss.askConsent() }}` on the page(s) which should display the modal.

Using Craft Cookie boss
-----------------------

[](#using-craft-cookie-boss)

### Display the consent modal

[](#display-the-consent-modal)

`craft.cookieBoss.askConsent(options, force)` is used to display the default consent modal.

AttributeTypeRequiredDescriptionoptionsobjectfalseAccepts `position` ('`top` or `bottom`-`left` or `right`')forcebooleanfalseForce the modal#### Examples

[](#examples)

Display the modal `craft.cookieBoss.getConsents()`

Display the modal in the top right corner `craft.cookieBoss.getConsents({'position': 'top-right'})`

Display the modal always:

```
{{ craft.cookieBoss.getConsents({}, true) }}

```

---

### Display cookie descriptions

[](#display-cookie-descriptions)

Display a table with all enabled cookies. The table has `#cookie-descriptions` as id. Each cookie is provided with the class `.consent-true` or `.consent-false` depending on the consentgroup's consent. All cookies are grouped by their group which has the class `.cookie-descriptions-group-title`. If you like more control you can use `craft.cookieBoss.getCookiesRaw()`.

#### Examples

[](#examples-1)

Display a table with all enabled cookies

```
{{ craft.cookieBoss.getCookies() }}

```

---

### Display cookie group toggle checkbox

[](#display-cookie-group-toggle-checkbox)

Displays a checkbox which toggles the specified consent group. For more control see 'Toggle consent group with a form'

AttributeTypeRequiredDescriptionhandlestringtrueUse a handle from the settings#### Examples

[](#examples-2)

Display a checkbox which can be used to toggle a consent group

```
{{ craft.cookieBoss.toggleConsentGroupForm('marketing') }}

```

---

### Get all visitor consents

[](#get-all-visitor-consents)

`craft.cookieBoss.getConsents(defaultConcentIfNotSet)` is used to get an array with the visitor's consents.

AttributeTypeRequiredDescriptiondefaultConcentIfNotSetbooleanfalsereturn the default consents if the visitor doens't have any consents#### Examples

[](#examples-3)

Get all consents of the current visitor `craft.cookieBoss.getConsents()`

Get all consents of the current visitor. Get default values if noting found. `craft.cookieBoss.getConsents(true)`

---

### Get visitor consent date

[](#get-visitor-consent-date)

`craft.cookieBoss.getConsentGiveAt(format)` is used to get the unix time or formated date of the visitor's consents.

AttributeTypeRequiredDescriptionformatstringfalseFormat the timestamp#### Examples

[](#examples-4)

Get the current visitor time of consent. `craft.cookieBoss.getConsentGiveAt()`

Get the current visitor time of consent in given format. `craft.cookieBoss.getConsentGiveAt("d-m-Y")`

---

### Get if visitor gave consent for cookie group

[](#get-if-visitor-gave-consent-for-cookie-group)

`craft.cookieBoss.isConsentWith(handle)` is used to get the consent of the current visitor by handle.

AttributeTypeRequiredDescriptionhandlestringtrueUse a handle from the settings#### Examples

[](#examples-5)

Get consents of the current visitor

```
{% if craft.cookieBoss.isConsentWith('marketing') %}
    We have permission to do marketing stuff
{% endif %}

```

---

### Get all consent groups

[](#get-all-consent-groups)

`craft.cookieBoss.getConsentsGroupsRaw(false)` is used to get all consent groups.

AttributeTypeRequiredDescriptiononlyEnabledbooleanfalseOnly return enabled consent groups#### Examples

[](#examples-6)

Get all consent groups.

```
craft.cookieBoss.getConsentsGroupsRaw()

```

---

### Get all consent groups by handle

[](#get-all-consent-groups-by-handle)

`craft.cookieBoss.getConsentsGroupRawByHandle(consentGroupHandle)` is used to get all cookie groups by handle.

AttributeTypeRequiredDescriptionconsentGroupHandlestringtrueUse a handle from the settings#### Examples

[](#examples-7)

Get all cookie groups by handle.

```
craft.cookieBoss.getConsentsGroupRawByHandle()

```

---

### Get all cookie descriptions

[](#get-all-cookie-descriptions)

`craft.cookieBoss.getCookiesRaw()` is used to get all cookie descriptions. `craft.cookieBoss.getCookiesRaw(consentGroupHandle)` is used to get all cookie descriptions for a consent group.

AttributeTypeRequiredDescriptionconsentGroupHandlestringtrueUse a handle from the settings#### Examples

[](#examples-8)

Get all cookie descriptions

```
craft.cookieBoss.getCookiesRaw()

```

---

### Custom modal

[](#custom-modal)

`craft.cookieBoss.getConsentsGroupsRaw()` will return all raw data which you can use to create a custom modal.

### Save the settings

[](#save-the-settings)

`/craft-cookie-boss/save-consent-settings` accepts `POST` requests with new consent settings. Usage of the Craft csrf token is required. Use `craft.app.request.csrfParam` to get the key and `craft.app.request.csrfToken` to get the actual token.

AttributeTypeRequiredDescriptiontoggledobjecttrueUse a handle from the settings`csrfParam`stringtrueCraft csrf token. Use the `csrfParam` as key#### Example request data

[](#example-request-data)

```
    "groups": {
        "technical": true,
        "marketing": false
    },
    "CRAFT_CSRF_TOKEN": "ABC...XYZ"

```

---

### Toggle a consent group with a custom form

[](#toggle-a-consent-group-with-a-custom-form)

Do a `POST` request to `/cookie-boss/toggle-consent-group`. For each group you wish to toggle you need to pass a boolean represented by the handle name.

#### Example form

[](#example-form)

```
{% set handle = 'marketing %}
{% set consentGroup = craft.cookieBoss.getConsentsGroupRawByHandle(handle) %}

    {{ csrfInput() }}
    {{ redirectInput(craft.app.request.pathInfo) }}

```

---

Craft Cookie Boss Roadmap
-------------------------

[](#craft-cookie-boss-roadmap)

Some things to do, and ideas for potential features:

- More templates (Modals)
- Support for different settings per site (multisite)
- Javascript events

Brought to you by [Dutch Height](www.dutchheight.com)

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 94.9% 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 ~41 days

Recently: every ~71 days

Total

19

Last Release

1678d ago

### Community

Maintainers

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

---

Top Contributors

[![KevinBeckers](https://avatars.githubusercontent.com/u/4037137?v=4)](https://github.com/KevinBeckers "KevinBeckers (37 commits)")[![billythekid](https://avatars.githubusercontent.com/u/330170?v=4)](https://github.com/billythekid "billythekid (1 commits)")[![freimutt](https://avatars.githubusercontent.com/u/11332285?v=4)](https://github.com/freimutt "freimutt (1 commits)")

---

Tags

cmsCraftcraftcmscraft-plugincraft cookiecraft cookie bosscraft cookie consent

### Embed Badge

![Health badge](/badges/dutchheight-craft-cookie-boss/health.svg)

```
[![Health](https://phpackages.com/badges/dutchheight-craft-cookie-boss/health.svg)](https://phpackages.com/packages/dutchheight-craft-cookie-boss)
```

###  Alternatives

[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.4M46](/packages/nystudio107-craft-seomatic)[verbb/image-resizer

Resize assets when they are uploaded.

127269.1k7](/packages/verbb-image-resizer)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[wrav/oembed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.

36205.0k3](/packages/wrav-oembed)[verbb/hyper

A user-friendly links field for Craft.

24130.9k9](/packages/verbb-hyper)

PHPackages © 2026

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