定制 dystcz/laravel-cookie-consent-history 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dystcz/laravel-cookie-consent-history

Composer 安装命令:

composer require dystcz/laravel-cookie-consent-history

包简介

This package allows you to simply store cookie consent history for users, so you can access it later in the unfortunate event of inspection or something.

README 文档

README

Latest Version on Packagist Total Downloads

This packages aims to make it easy to store anonymous cookie consents in a database in order to comply with rather strict EU cookie policy laws. Your application will get the power of keeping consent history, so you will have no problem with your burden of proof process when someone complains about your cookie consents.

Installation

You can install the package via composer:

composer require dystcz/laravel-cookie-consent-history

Publish config and migrations, run migrations

php artisan vendor:publish --provider="Dystcz\CookieConsentHistory\CookieConsentHistoryServiceProvider"
php artisan migrate

Register package routes in some of your route files, but if you want to use your own routes and controller, that is completely fine.

// routes/api.php

use Dystcz\CookieConsentHistory\CookieConsentHistoryFacade;

CookieConsentHistoryFacade::routes();

Configuration

return [
    /**
     * The prefix for the table names.
     * You can use your own prefix here, eg. company_ if it were to conflict with existing table names.
     * We leave it empty, so the table name is cookie_consents by default.
     */
    'table_prefix' => '',

    /**
     * The prefix for routes.
     * There are only 2 routes, one for storing the consent data and one for retrieving.
     *
     * POST /cookie-consents (or your prefix) saves the consent
     * GET /cookie-consents/{id} gets the consent if exists
     */
    'route_prefix' => 'cookie-consents',

    /**
     * Model definition.
     * You can extend the base model to your needs.
     */
    'model' => Dystcz\CookieConsentHistory\Models\CookieConsent::class,
];

Usage

Storing consents

You can either register package routes, or you can introduce your own with your controller.

Below is an example store method which comes from Dystcz\CookieConsentHistory\Http\Controllers\CookieConsentsController.

/**
* Store cookie consent data.
*
* @param StoreCookieConsentRequest $request
*
* @return \Illuminate\Http\JsonResponse
*/
public function store(StoreCookieConsentRequest $request)
{
    // Create DTO out of validated request
    $data = new CookieConsentData(...$request->validated());

    $consent = CookieConsentHistory::save($data);

    return new JsonResponse([
        'data' => $consent,
    ]);
}

Complementary front end package

We aim to also provide a complementary javascript package, that will work nicely with this package making cookie law compliance as easy as possible.

Stay tuned.

Testing

Tests coming soon!

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email jakub@dy.st instead of using the issue tracker.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固