ezsystems/privacy-cookie-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ezsystems/privacy-cookie-bundle

最新稳定版本:v1.0.0-beta8

Composer 安装命令:

composer require ezsystems/privacy-cookie-bundle

包简介

Privacy cookie banner integration bundle into regular Symfony 2.x application (supports eZ Publish/eZ Platform)

README 文档

README

SensioLabsInsight

This bundle adds privacy cookie banner into Symfony applications.

screenshot

Requirements

  • Symfony v2.6 or later (including Symfony 3.x)

Installation

This package is available via Composer, so the instructions below are similar to how you install any other open source Symfony Bundle.

Run the following command in a terminal, from your Symfony installation root (pick most recent release):

php composer.phar require ezsystems/privacy-cookie-bundle

Enable the bundle in app/AppKernel.php file:

$bundles = array(
    // existing bundles
    new EzSystems\PrivacyCookieBundle\EzSystemsPrivacyCookieBundle(),
);

Add external assets to your bundle:

  • CSS:
bundles/ezsystemsprivacycookie/css/privacycookie.css
  • JS:
bundles/ezsystemsprivacycookie/js/privacycookie.js

Assetic (Optional)

Enable the Assetic bundle in app/AppKernel.php file:

$bundles = array( // ... // starting from Symfony 2.8 you have to enable AsseticBundle manually if you haven't done it before new Symfony\Bundle\AsseticBundle\AsseticBundle() );

Add the following minimal configuration in config.yml file to enable Assetic support in your application (Symfony 2.8 and later):

assetic:
    debug: '%kernel.debug%'
    use_controller: '%kernel.debug%'
    filters:
        cssrewrite: ~

If you are installing the bundle via composer require you must also copy assets to your project's web directory. You can do this by calling Symfony's built-in command from the project root directory:

For Symfony 2.x:

php app/console assets:install --symlink

For Symfony 3.x:

php bin/console assets:install --symlink

In production environment you have to dump assets using Assetic built-in command:

For Symfony 2.x:

php app/console assetic:dump -e=prod

For Symfony 3.x:

php bin/console assetic:dump -e=prod

Usage

Insert the following {{ show_privacy_cookie_banner(%privacy_policy_url%) }} helper somewhere in your footer template before the body ending tag. Replace the %privacy_policy_url% parameter with your policy page address.

Note that the %privacy_policy_url% parameter is not required, in this case no policy link will be shown.

The following optional parameters can be set as a second argument in an array format:

Parameter Default value Description
cookieName privacyCookieAccepted Sets your own status cookie name
cookieValidity 365 Says how many days privacy banner should be hidden when user accepts policy?
cookiePath null Specifies the cookie path (by default cookie will be available only for the current domain)
caption Cookies help us create a good experience (...) Sets your own banner message caption
learnMoreText Learn More Sets title and text of privacy link
extraParams Extra Params Send extra params in your override template

Example of usage in standard Symfony application:

{{ show_privacy_cookie_banner('http://ez.no/Privacy-policy') }}

or

{{ show_privacy_cookie_banner('http://ez.no/Privacy-policy', {
   cookieName: 'myCookie',
   cookieValidity: 7,
   cookiePath: '/',
   caption: 'Nice to see you here',
   learnMoreText: 'Find out more'
}) }}

If you are using eZ Publish / Platform you can use ez_urlalias to generate path for specified content object:

{{ show_privacy_cookie_banner(path('ez_urlalias', {contentId: 94}), {
   cookieName: 'myCookie',
   cookieValidity: 7,
   caption: 'Nice to see you here'
}) }}

Example of usage extraParams:

{{ show_privacy_cookie_banner('http://ez.no/Privacy-policy', {
   cookieName: 'myCookie',
   extraParams: {
       my_param1: value_my_param1 ,
       my_param2: value_my_param2
   }
}) }}

ezsystems/privacy-cookie-bundle 适用场景与选型建议

ezsystems/privacy-cookie-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27.8k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「twig」 「cookies」 「Policy」 「privacy」 「ezpublish」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ezsystems/privacy-cookie-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ezsystems/privacy-cookie-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 ezsystems/privacy-cookie-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 27.8k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 22
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 25
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2015-04-08