PHPackages                             bizley/cookiemonster - 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. bizley/cookiemonster

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

bizley/cookiemonster
====================

Yii extension to manage cookie warning.

1.1.0(5y ago)2020.1k↓48.6%[1 PRs](https://github.com/bizley/yii2-cookiemonster/pulls)1BSD-3-ClausePHPPHP &gt;=5.4CI passing

Since May 29Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/bizley/yii2-cookiemonster)[ Packagist](https://packagist.org/packages/bizley/cookiemonster)[ GitHub Sponsors](https://github.com/bizley)[ RSS](/packages/bizley-cookiemonster/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (6)Used By (1)

yii2-cookiemonster
==================

[](#yii2-cookiemonster)

Yii 2 extension to manage cookie warning

[![Latest Stable Version](https://camo.githubusercontent.com/3ffefe993f0a9a63edeca884e78423e04749ed3a20864da38aa875dbab28886e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62697a6c65792f636f6f6b69656d6f6e737465722e737667)](https://camo.githubusercontent.com/3ffefe993f0a9a63edeca884e78423e04749ed3a20864da38aa875dbab28886e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62697a6c65792f636f6f6b69656d6f6e737465722e737667)[![Total Downloads](https://camo.githubusercontent.com/5db1fe48f4bfbf2e03f94d7bc65f3dd405d7d1902a504d430c112cb5239e1dc6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62697a6c65792f636f6f6b69656d6f6e737465722e737667)](https://camo.githubusercontent.com/5db1fe48f4bfbf2e03f94d7bc65f3dd405d7d1902a504d430c112cb5239e1dc6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62697a6c65792f636f6f6b69656d6f6e737465722e737667)[![License](https://camo.githubusercontent.com/1abfd43530389952fa48c2366c933407c8fc53663ebdeb1fe1bb02eee6cc4ded/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f62697a6c65792f636f6f6b69656d6f6e737465722e737667)](https://camo.githubusercontent.com/1abfd43530389952fa48c2366c933407c8fc53663ebdeb1fe1bb02eee6cc4ded/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f62697a6c65792f636f6f6b69656d6f6e737465722e737667)[![Mutation testing badge](https://camo.githubusercontent.com/39dcd4c9d3ebd6bac83a2ac820dad5a57bba4db326b1e4ad864dff7b91dddd9f/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d25324662697a6c6579253246796969322d636f6f6b69656d6f6e737465722532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/bizley/yii2-cookiemonster/master)

What is it for?
---------------

[](#what-is-it-for)

In 2009, the European Union sought new regulations as part of an "e-privacy" directive, seeing cookies as a potential threat to privacy, because users often don't know they are being tracked.
This extension adds the information about cookies for the Yii website.

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

[](#requirements)

Yii 2

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

[](#installation)

Get it through composer by adding the package to your composer.json:

```
{
    "require": {
        "bizley/cookiemonster": "*"
    }
}
```

Or run `composer require bizley/cookiemonster`.

Usage
-----

[](#usage)

Add this code in your main template file just before ``

```

```

This will render widget with all default options (and 'top' layout).
If you want to configure it add options array.

```

```

All options (and options' options) are described below.
For example if you want to use custom message on the button and use 'bottom' layout set:

```

```

Configuration
-------------

[](#configuration)

You can set widget options by passing array to the widget() method with the following keys:

- `box` - **array** CSS class and styles and HTML options for div
- `content` - **array** warning and button message
- `cookie` - **array** cookie options
- `mode` - **string** widget layout selection
- `params` - **mixed** user's parameters to pass to the custom widget layout

`box` options
-------------

[](#box-options)

- `addButtonStyle` - **array** list of button CSS style options to be added or replaced with new values i.e. 'padding-right' =&gt; '20px', 'font-weight' =&gt; 'bold'
- `addInnerStyle` - **array** list of inner div CSS style options to be added or replaced with new values
- `addOuterStyle` - **array** list of outer div CSS style options to be added or replaced with new values
- `buttonHtmlOptions` - **array** list of button HTML options to be added (except style and class)
- `classButton` - **string** button class or classes (separated by spaces), default 'CookieMonsterOk'
- `classInner` - **string** inner div class or classes (separated by spaces)
- `classOuter` - **string** outer div class or classes (separated by spaces), default 'CookieMonsterBox'
- `innerHtmlOptions` - **array** list of inner div HTML options to be added (except style and class)
- `outerHtmlOptions` - **array** list of outer div HTML options to be added (except style and class)
- `replaceButtonStyle` - **array** list of button CSS style options to be replaced with new values or removed i.e. 'margin-left' =&gt; '10px', 'font-size' =&gt; false
- `replaceInnerStyle` - **array** list of inner div CSS style options to be replaced with new values or removed
- `replaceOuterStyle` - **array** list of outer div CSS style options to be replaced with new values or removed
- `setButtonStyle` - **array** list of button CSS style options to be set replacing the default ones
- `setInnerStyle` - **array** list of inner div CSS style options to be set replacing the default ones
- `setOuterStyle` - **array** list of outer div CSS style options to be set replacing the default ones
- `view` - **string** path to the custom view (required if $mode is set to 'custom'), for views outside the widget folder use alias path i.e. '@app/views/cookie'

`content` options
-----------------

[](#content-options)

- `buttonMessage` - **string** button original message as in Yii::t() $message, default 'I understand'
- `buttonParams` - **array** parameters to be applied to the buttonMessage as in Yii::t() $params, default array()
- `category` - **string** message category as in Yii::t() $category, default 'app'
- `language` - **string** target language as in Yii::t() $language, default null
- `mainMessage` - **string** main original message as in Yii::t() $message, default 'We use cookies on our websites to help us offer you the best online experience. By continuing to use our website, you are agreeing to our use of cookies. Alternatively, you can manage them in your browser settings.'
- `mainParams` - **array** parameters to be applied to the mainMessage as in Yii::t() $params, default array()

`cookie` options
----------------

[](#cookie-options)

- `domain` - **string** domain name for the cookie, default host portion of the current document location
- `expires` - **integer** number of days this cookie will be valid for, default 30
- `max-age` - **integer** max cookie age in seconds
- `path` - **string** path for the cookie, default '/'
- `secure` - **boolean** whether cookie should be transmitted over secure protocol as https, default false
- `sameSite` - **string** 'lax' (default), 'strict', or 'none'

`mode` possible values
----------------------

[](#mode-possible-values)

- `bottom` - bottom strip
- `box` - bottom right box
- `custom` - custom mode defined by user (requires `box[view]` to be set)
- `top` - top strip, default

Default layouts
---------------

[](#default-layouts)

### bottom

[](#bottom)

```

        We use cookies on our websites to help us offer you the best online experience. By continuing to use our website, you are agreeing to our use of cookies. Alternatively, you can manage them in your browser settings.I understand

```

### box

[](#box)

```

        We use cookies on our websites to help us offer you the best online experience. By continuing to use our website, you are agreeing to our use of cookies. Alternatively, you can manage them in your browser settings.I understand

```

### top

[](#top)

```

        We use cookies on our websites to help us offer you the best online experience. By continuing to use our website, you are agreeing to our use of cookies. Alternatively, you can manage them in your browser settings.I understand

```

Yii 1.1 version
---------------

[](#yii-11-version)

You can find Yii 1.1 version at

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance58

Moderate activity, may be stable

Popularity34

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 69.4% 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 ~702 days

Total

4

Last Release

1898d ago

### Community

Maintainers

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

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (59 commits)")[![bizley](https://avatars.githubusercontent.com/u/8577314?v=4)](https://github.com/bizley "bizley (26 commits)")

---

Tags

cookiehacktoberfestwidgetyii2yii2cookiewidgetprivacywarningcookiemonster

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bizley-cookiemonster/health.svg)

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

###  Alternatives

[softark/yii2-dual-listbox

Bootstrap Dual Listbox Widget for Yii 2

20144.4k11](/packages/softark-yii2-dual-listbox)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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