easyrider7522/yii2-cookieconsent
Composer 安装命令:
composer require easyrider7522/yii2-cookieconsent
包简介
Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget
README 文档
README
Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget
Thanks to insites
Installation
Composer
composer require easyrider7522/yii2-cookieconsent "@alpha"
or manually add to the required section of your project's composer.json
"easyrider7522/yii2-cookieconsent": "@alpha"
and run composer update shell command
Since it's a pre-release (currently in alpha state) stability flag @alpha must be used with the package (as you can see above) in order to be able to install it without changing minimum-stability property of the composer.json, which is global for your whole project.
Usage
As any Yii2 widget, in desired view or layout file as follows:
<?php use easyrider7522\cookieconsent\CookieConsent; CookieConsent::widget([ 'lang' => 'en', 'options' => [ 'palette' => [ 'popup' => [ 'background' => '#222', 'text' => '#fff', ], 'button' => [ 'background' => '#459f45', 'text' => '#fff', ], ], 'theme' => 'classic', 'position' => 'top', 'type' => 'opt-in', 'content' => [ 'message' => 'This website uses cookies to ensure you get the best experience on our website.', 'dismiss' => 'Got it!', 'link' => 'Learn more', 'href' => 'http://cookiesandyou.com/', ], ], ]);
Customization can be easily done on the plugin developer's site and manually translated to PHP array.
Property optionJs was introduced for compatibility with native JS so, the chosen settings can be directly copied from the interactive configurator to it as string, containing the JavaScript object data (options property is ignored if optionsJs evaluates to true):
CookieConsent::widget([ 'optionsJs' => '{ "palette": { "popup": { "background": "#000" }, "button": { "background": "#f1d600" } }, "position": "top" }', ]);
Removal
composer remove easyrider7522/yii2-cookieconsent
or manually delete it from the required section of your project's composer.json and run composer update
Dependencies
Screenshots
Sample 1. Widget is overlapping Yii's default main menu ot the top of the page.
Sample 2. Widget is at the bottom of the page.
Sample 3. Widget is a box at page's bottom-right corner.
统计信息
- 总下载量: 3.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-12



