pascalkrieger/laravel-cookie-consent 问题修复 & 功能扩展

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

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

pascalkrieger/laravel-cookie-consent

Composer 安装命令:

composer require pascalkrieger/laravel-cookie-consent

包简介

Allow/disallow types of cookies in your Laravel Application

README 文档

README

This package currently work in progress.

The package provides the views and controllers necessary to display a fixed message at the bottom of the window, prompting the user to accept the cookies or configure them.

If the user chooses to configure the cookies a modal will be displayed listing all types of cookies the website uses, allowing to disable or enable certain types. Once his preferences are saved a button is displayed enabling the user to configure his preferences.

The views are styled with tailwindcss and alpinejs leverages the rest, so these are prerequisite in your Laravel project.

Once the preferences are saved, you can check in your views if a certain type of cookies is allowed like this:

@if(session('cookie-config.Functional')) 
    //Your code, maybe a Google Analytics tag 
@endif

Where Functional corresponds to one of the type values in the cookies array of your config file.

Installation

This package is intended for use in existing Laravel projects using Tailwindcss and AlpineJS.

You can install the package via composer:

composer require pascalkrieger/laravel-cookie-consent

Tailwindcss and AlpineJS should be installed, if not install them following the instructions in their documentation.

For Tailwindcss visit: https://tailwindcss.com/docs/guides/laravel

For AlpineJS visit: https://alpinejs.dev/essentials/installation

Publish the views running:

php artisan vendor:publish --provider="Pascalkrieger\LaravelCookieConsent\LaravelCookieConsentServiceProvider" --tag="laravel-cookie-consent-views"

Then run:

npm run build

Usage

Include the blade component at the bottom of your page or layout:

    <x-laravel-cookie-consent::index /> 

You should publish and edit the config file, run this command:

    php artisan vendor:publish --provider="Pascalkrieger\LaravelCookieConsent\LaravelCookieConsentServiceProvider" --tag="laravel-cookie-consent-config"

The code is pretty basic and self explanatory. As stated before this is work in progress, in use right now in some of my other projects. You´re welcome to use it as you wish.

Localization

The package currently ships with translations for English and Spanish. you can easily add more languages, first publish the packages lang folder with:

    php artisan vendor:publish --provider="Pascalkrieger\LaravelCookieConsent\LaravelCookieConsentServiceProvider" --tag="laravel-cookie-consent-lang"

Add a folder to lang/vendor/laravel-cookie-consent with your language code, for example lang/vendor/laravel-cookie-consent/de, and place a text.php file with the following contents within it:

// lang/vendor/laravel-cookie-consent/de/text.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Laravel Cookie Consent Language Lines
    |--------------------------------------------------------------------------
    |
    |
    */

    'modal-heading' => 'Cookie-Konfiguration',
    'configure' => 'Konfigurieren',
    'accept' => 'Akzeptieren',
    'back' => 'Zurück',
    'my-cookies-button' => 'Meine Cookies',

    'modal-body' => 'Hier können Sie die von uns verwendeten Cookies überprüfen und konfigurieren, welche Cookies Sie in Ihrem Webbrowser installieren möchten.',

    'message' => 'Wir verwenden unsere eigenen Cookies und Cookies von Drittanbietern beim Surfen auf der Website, um den Zugriff auf die Funktionen der Website zu ermöglichen, Verkehrsstatistiken zu extrahieren und die Benutzererfahrung zu verbessern. Sie können alle Cookies akzeptieren und auswählen, welche Sie aktivieren möchten. Weitere Informationen finden Sie in unserer Cookie-Richtlinie.',

];

pascalkrieger/laravel-cookie-consent 适用场景与选型建议

pascalkrieger/laravel-cookie-consent 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-21