nickdekruijk/cookie-consent
Composer 安装命令:
composer require nickdekruijk/cookie-consent
包简介
A simple cookie accept popup for EU laws
README 文档
README
According to EU laws visitors should opt-in for all non essential cookies. This package adds a simple 'Accept Cookies' popup to your Laravel Application.
Installation
To install package use
composer require nickdekruijk/cookie-consent
Publish the config file in case you want to customize it
php artisan vendor:publish --provider=NickDeKruijk\\CookieConsent\\CookieConsentServiceProvider
Frontend
Add this to every view/page where you want to show the popup
@include('cookieconsent::show')
And wrap any code that places tracking cookies/pixels/code with the cookieConsentAccepted() helper, for example like this:
@if (cookieConsentAccepted()) // Your tracking code here @endif
And style the popup as you like, for example:
.cookieconsent-container {position:fixed;bottom:0;left:0;right:0;background-color:red;text-align:center;padding:50px;z-index:9999;color:#fff} .cookieconsent-close {position:absolute;top:0;right:0;color:red;font-size:50px;padding:10px;line-height:.7;font-weight:bold;display:block} .cookieconsent-button {display:inline-block;padding:10px 20px;border:2px solid #fff;border-radius:5px;text-decoration:none;color:inherit;margin:10px} .cookieconsent-button:hover {background-color:rgba(255,255,255,0.5)} .cookieconsent-button-accept {background-color:#fff;color:red} .cookieconsent-button-accept:hover {background-color:rgba(255,255,255,0.8)}
Changing text/localization
To change te tekst/buttons/info link copy the files from https://github.com/nickdekruijk/cookie-consent/tree/master/src/translations to /resources/lang/vendor/cookieconsent/ file and edit where needed.
统计信息
- 总下载量: 70
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-07