didublab/cookielaw
Composer 安装命令:
composer require didublab/cookielaw
包简介
A simple Symfony bundle to display a cookie law message.
README 文档
README
This is a simple Symfony bundle to display a cookie law message on your Symfony 4 and Symfony 5 projects with small setup.
Install the bundle:
Using composer
composer require didublab/cookielaw
Render the cookie law:
In your twig, add the twig function where you want to load the cookie consent:
{{ cookie_law() }}
This is the minimum setup, but if you want more, you can configure a few options:
Configure options:
Create a new config file in your config/packages/ directory, named for example: cookie_law.yaml This are the available options with the default options:
didublab_cookielaw: cookie_name: cookie-notice-accepted #the cookie name cookie_value: true #the cookie value cookie_days: 10 #cookie expiration in days cookie_readmore_route: false #the route where you want to redirect the users to the "read more" section
Translations
You can translate the text of the cookie law at your needs
- Create inside the translations directory a file called cookielaw.(language).xliff
- Inside add the following content below and change the "target" tag with your translations
<?xml version="1.0"?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file source-language="en" target-language="en" datatype="plaintext" original="file.ext"> <body> <trans-unit id="didublab_cookielaw_cookie_text"> <source>didublab_cookielaw_cookie_text</source> <target>This website use cookies. By continuing to browse this website, you declare to accept the use of cookies.</target> </trans-unit> <trans-unit id="didublab_cookielaw_cookie_accept"> <source>didublab_cookielaw_cookie_accept</source> <target>Accept</target> </trans-unit> <trans-unit id="didublab_cookielaw_cookie_readmore"> <source>didublab_cookielaw_cookie_readmore</source> <target>More info</target> </trans-unit> </body> </file> </xliff>
didublab/cookielaw 适用场景与选型建议
didublab/cookielaw 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 42 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 06 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 didublab/cookielaw 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 didublab/cookielaw 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-05