valantic-spryker/customer-storage 问题修复 & 功能扩展

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

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

valantic-spryker/customer-storage

Composer 安装命令:

composer require valantic-spryker/customer-storage

包简介

Allows to publish non privacy related customer data into storage.

关键字:

README 文档

README

Minimum PHP Version

Description

  • Allows to publish non privacy related customer data into storage.

Install

  • composer require valantic-spryker/customer-storage
  • register publisher plugins
    // Zed\Publisher\PublisherDependencyProvider.php
    /**
     * @return array
     */
    private function getCustomerStoragePlugins(): array
    {
        return [
            CustomerStorageConfig::PUBLISH_CUSTOMER => [
                new CustomerWritePublisherPlugin(),
                new CustomerDeletePublisherPlugin(),
                new CustomerGroupToCustomerWritePublisherPlugin(),
                new CustomerGroupToCustomerDeletePublisherPlugin(),
                new CustomerAddressWritePublisherPlugin(),
            ],
        ];
    }
  • create customer storage queues
 // Client\RabbitMq\RabbitMqConfig.php
     /**
     * @return array
     */
    protected function getPublishQueueConfiguration(): array
    {
        return [
            [...]
            CustomerStorageConfig::PUBLISH_CUSTOMER,
            [...]
        ];
    }

    /**
     * @return array
     */
    protected function getSynchronizationQueueConfiguration(): array
    {
        return [
            [...]
            CustomerStorageConfig::SYNC_CUSTOMER_STORAGE,
            [...]
        ];
    }

    /**
     * @return \ArrayObject
     */
    protected function getQueueOptions(): ArrayObject
    {
        $queueOptionCollection = parent::getQueueOptions();

        $queueOptionCollection->append($this->createQueueOptionTransfer(CustomerStorageConfig::SYNC_CUSTOMER_STORAGE, CustomerStorageConfig::SYNC_CUSTOMER_STORAGE_ERROR));
    
        return $queueOptionCollection;
    }
  • add processor to queue:worker command
    // Zed\Queue\QueueDependencyProvider.php
        /**
     * @param \Spryker\Zed\Kernel\Container $container
     *
     * @return array<\Spryker\Zed\Queue\Dependency\Plugin\QueueMessageProcessorPluginInterface>
     */
    protected function getProcessorMessagePlugins(Container $container): array
    {
        [...]
            CustomerStorageConfig::PUBLISH_CUSTOMER => new EventQueueMessageProcessorPlugin(),
            CustomerStorageConfig::SYNC_CUSTOMER_STORAGE => new SynchronizationStorageQueueMessageProcessorPlugin(),
        [...]
    }
    
  • if you use default customer importer, ensure customer-storage publisher event is triggered
    // Zed\CustomerImport\Business\Model\CustomerImporterPlugin
    public function import(array $data): void
    {
        [...]
            QueueImporterPublisher::addEvent(
                CustomerStorageConfig::PUBLISH_CUSTOMER_WRITE,
                $idCustomer,
            );
        [...]
    }
            
  • configure the data you like to expose
    // Zed\CustomerStorage\Business\Mapper\CustomerStorageMapper
    protected function getCustomerStorageData(SpyCustomerEntityTransfer $customerEntityTransfer): array
    {
        $data = [];
        $data['idCustomer'] = $customerEntityTransfer->getIdCustomer();
        $data['customerGroup'] = ($customerEntityTransfer->getSpyCustomerGroupToCustomers()->count() > 0) ? ($customerEntityTransfer->getSpyCustomerGroupToCustomers()[0]->getCustomerGroup()?->getName()) : null;
        $data['sponsorReference'] = $customerEntityTransfer->getSponsorReference();
        $data['priceGroup'] = $customerEntityTransfer->getPriceGroup();
        $data['store'] = $customerEntityTransfer->getSpyStore()?->getName();
        $data['country'] = $customerEntityTransfer->getBillingAddress()?->getCountry()?->getName();
        $data['zipCode'] = $customerEntityTransfer->getBillingAddress()?->getZipCode();

        return $data;
    }
  • if you like to use console publisher:trigger-events customer -> register publisher plugin
    // Zed\Publisher\PublisherDependencyProvider
    [...]
    new CustomerPublisherTriggerPlugin(),
    [...]

HowTos Cli

PHP Container: docker run -it --rm --name my-running-script -v "$PWD":/data spryker/php:latest bash

Run Tests: codecept run --env standalone

Fixer: vendor/bin/phpcbf --standard=phpcs.xml --report=full src/ValanticSpryker/

Disable opcache: mv /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini /usr/local/etc/php/conf.d/docker-php-ext-opcache.iniold

XDEBUG:

  • ip addr | grep '192.'

  • $docker-php-ext-enable xdebug

  • configure phpstorm (add 127.0.0.1 phpstorm server with name valantic)

  • $PHP_IDE_CONFIG=serverName=valantic php -dxdebug.mode=debug -dxdebug.client_host=192.168.87.39 -dxdebug.start_with_request=yes ./vendor/bin/codecept run --env standalone

  • Run Tests with coverage: XDEBUG_MODE=coverage vendor/bin/codecept run --env standalone --coverage --coverage-xml --coverage-html

use nodejs

  • docker run -it --rm --name my-running-script -v "$PWD":/data node:18 bash

valantic-spryker/customer-storage 适用场景与选型建议

valantic-spryker/customer-storage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.78k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 08 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 valantic-spryker/customer-storage 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-08-07