承接 wwwision/likes 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

wwwision/likes

Composer 安装命令:

composer require wwwision/likes

包简介

Simple Neos Flow package that allows to track arbitrary "likes" or recommendations

README 文档

README

Simple Neos Flow package that allows to track arbitrary "likes" or recommendations using Event-Sourcing.

Installation

Install this package using composer:

composer require wwwision/likes

Setup

Event Store

By default, this package is configured to use the DoctrineEventStorage to store events with the default options. This means, that "like"-events will be stored in a database table neos_eventsourcing_eventstore_events by default. This can be changed with a few lines of Settings.yaml:

Neos:
  EventSourcing:
    EventStore:
      stores:
        'Wwwision.Likes:EventStore':
          storageOptions:
            eventTableName: 'wwwision_like_events'

Afterwards the Event Store should be set-up via

./flow eventstore:setup Wwwision.Likes:EventStore

Metadata / GDPR

By default all events published by this package will contain metadata that contains details about the currently active HTTP request including request URL, method, userAgent and clientIP headers.

This behavior can be adjusted via Settings.yaml:

Wwwision:
  Likes:
    eventMetadata:
      # disable tracking of absolute HTTP request URL
      url: true
      # disable tracking of HTTP request Method (GET, POST, ...)
      method: true
      # disable tracking of users IP address
      clientIpAddress: true
      # disable tracking of browsers "userAgent" header
      userAgent: true

Usage

From PHP use the provided LikeService to add/revoke likes and to retrieve details about existing likes. The service should be mostly self-explanatory, but it isn't meant to be used directly. Instead, it should be wrapped in some service that is more specific to the actual domain.

Example

final class FavoriteCoffeeBeans {
  
    private LikeService $likeService;

    private User $authenticatedUser;

    public function __construct(LikeService $likeService, User $authenticatedUser) {
        $this->likeService = $likeService;
        $this->authenticatedUser = $authenticatedUser;
    }

    public function addCoffeeBean(CoffeeBean $coffeeBean): void
    {
        $this->likeService->addLike('CoffeeBeans', (string)$this->authenticatedUser->getId(), (string)$coffeeBean->getId());
    }

    public function removeCoffeeBean(CoffeeBean $coffeeBean): void
    {
        $this->likeService->revokeLike('CoffeeBeans', (string)$this->authenticatedUser->getId(), (string)$coffeeBean->getId());
    }

    public function contains(CoffeeBean $coffeeBean): bool
    {
        return $this->likeService->likeExists('CoffeeBeans', (string)$this->authenticatedUser->getId(), (string)$coffeeBean->getId());
    }
}

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固