zencule/cookie-banner 问题修复 & 功能扩展

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

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

zencule/cookie-banner

Composer 安装命令:

composer require zencule/cookie-banner

包简介

A modern, customizable cookie consent banner for Laravel and Statamic applications

README 文档

README

A modern, customizable cookie consent banner for Laravel and Statamic applications. Built with Alpine.js and plain CSS (no Tailwind required).

License

Features

  • 🎨 Modern, responsive design with plain CSS (no Tailwind required)
  • ⚡ Smooth animations with Alpine.js
  • 📊 Google Analytics integration
  • 🔒 GDPR-compliant with essential/all cookies options
  • 🎯 Works with both Laravel and Statamic
  • ⚙️ Fully customizable through config

Installation

You can install the package via composer:

composer require zencule/cookie-banner

CSS

The package includes a plain CSS file for styling. To use the default styles, import or copy cookie-banner.css from the package's resources/ directory into your project and include it in your main CSS or HTML:

<link rel="stylesheet" href="/path/to/cookie-banner.css">

Or, if using a bundler:

import 'cookie-banner/resources/cookie-banner.css';

Laravel

The package will automatically register its service provider.

Publish the configuration file:

php artisan vendor:publish --tag=cookie-banner

Statamic

The package will automatically register as a Statamic addon.

Publish the configuration file:

php artisan vendor:publish --tag=cookie-banner

Usage

Laravel

Add the cookie banner to your layout file:

@include('cookie-banner::banner')

Statamic

Add the cookie banner to your layout file:

{{ zencule:cookie-banner }}

Configuration

Configure the banner in config/cookie-banner.php:

return [
    'privacy_policy_url' => env('COOKIE_BANNER_PRIVACY_URL', '/privacy-policy'),
    
    'analytics_id' => env('COOKIE_BANNER_ANALYTICS_ID', ''),
    
    'messages' => [
        'banner_text' => 'We use cookies to improve your experience...',
        'essential_button' => 'Essential Only',
        'accept_button' => 'Accept All',
        'more_info' => 'More Information',
    ],
];

Customization

Styling

The banner uses plain CSS classes by default. You can customize the appearance by:

  1. Publishing the views:
php artisan vendor:publish --tag=cookie-banner
  1. Modifying the templates in:

    • Laravel: resources/views/vendor/cookie-banner/blade/banner.blade.php
    • Statamic: resources/views/vendor/cookie-banner/antlers/banner.antlers.html
  2. Editing the CSS file:

    • Copy or import resources/cookie-banner.css and modify it as needed for your branding.

Analytics

By default, the package supports Google Analytics. Set your Analytics ID in your .env file:

COOKIE_BANNER_ANALYTICS_ID=G-XXXXXXXXXX

The script will only load after the user accepts all cookies.

Requirements

  • PHP 8.1 or higher
  • Laravel 10.0 or higher
  • Statamic 4.0 or higher (for Statamic integration)
  • Alpine.js

Contributing

Please see CONTRIBUTING.md for details.

Security

If you discover any security-related issues, please email security@zencule.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

zencule/cookie-banner 适用场景与选型建议

zencule/cookie-banner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 105 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 105
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-09