bkc-media/twill-cookie-consent
Composer 安装命令:
composer require bkc-media/twill-cookie-consent
包简介
A cookie twill package
README 文档
README
This package provides a simple way to add cookie consent to your Twill 3x project by adding cookie scripts based on user preferences using the CMS.
Requirements
- PHP: ^8.0
- area17/twill: ^3.0
- Laravel: ^8|^9
Installation
You can install the package via composer:
composer require bkc-media/twill-cookie-consent
Publish the assets to include necessary javascript and css files:
php artisan vendor:publish --provider="BKCmedia\TwillCookieConsent\TwillCookieConsentServiceProvider" --tag="twill-cookie-consent-assets" --force
Optionally publish the config file:
php artisan vendor:publish --provider="BKCmedia\TwillCookieConsent\TwillCookieConsentServiceProvider" --tag="twill-cookie-consent-config"
Optionally publish the lang files:
php artisan vendor:publish --provider="BKCmedia\TwillCookieConsent\TwillCookieConsentServiceProvider" --tag="twill-cookie-consent-translations"
The contents of the published config file will look like this:
return [ /* * The cookie name in which we store which cookie id's the user has consented to. */ 'cookie_name' => 'tcc_cookie_consent', /* * Set the cookie duration in minutes. Default is 60 * 24 * 365. */ 'cookie_lifetime' => 60 * 24 * 365, /* * Set primary color for cookie consent accept all buttons, default is green. */ 'primary_color' => '#65A30D', ];
Run migration to add the twill cookie singleton:
php artisan migrate
Usage
After migration you can add the cookie consent content by going to the cookie module in the CMS. Add the cookie consent banner description and intro settings content. Use the block editor to add cookie categories and the repeater inside the block to add cookie information and necessary scripts per location: head, body or footer.
Add the cookie consent banner to your app.blade.php file or any other layout file:
@include('twill-cookie-consent::components.cookie-consent')
Based on provider scripts add one or all of the following in the right location in your app.blade.php file or any other layout file:
@include('twill-cookie-consent::components.head-scripts') @include('twill-cookie-consent::components.body-scripts') @include('twill-cookie-consent::components.footer-scripts')
Based on the user preferences the scripts will be added to the page in the right location.
bkc-media/twill-cookie-consent 适用场景与选型建议
bkc-media/twill-cookie-consent 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 03 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bkc-media/twill-cookie-consent 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bkc-media/twill-cookie-consent 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-16