承接 prestashopcorp/module-lib-billing 相关项目开发

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

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

prestashopcorp/module-lib-billing

Composer 安装命令:

composer require prestashopcorp/module-lib-billing

包简介

Utility package to retrieve Built for PS context and more

README 文档

README

Utility package to retrieve Built for PS context and more

Latest Stable Version Minimum PHP Version Quality Control PHP

Installation

This package is available on Packagist, you can install it via Composer.

composer require prestashopcorp/module-lib-billing

Version Guidance

Version Status Packagist - Namespace Repo Docs PHP Version
1.x Security fixes module-lib-billing PrestaShopCorp\Billing v1 N/A >=5.6
2.x Security fixes module-lib-billing PrestaShopCorp\Billing v2 N/A >=7.2.5
3.x Latest module-lib-billing PrestaShopCorp\Billing v3 N/A >=5.6
4.x Latest module-lib-billing PrestaShopCorp\Billing v4 N/A >=5.6

Register as a service in your PSx container

Beforehand, you must have defined PS Account services

Example :

services:
  #####################
  # PS Billing
  ps_billings.context_wrapper:
    class: 'PrestaShopCorp\Billing\Wrappers\BillingContextWrapper'
    arguments:
      - '@ps_accounts.facade'
      - '@builtfor_example.context'
      - true # if true you are in sandbox mode, if false or empty not in sandbox

  ps_billings.facade:
    class: 'PrestaShopCorp\Billing\Presenter\BillingPresenter'
    arguments:
      - '@ps_billings.context_wrapper'
      - '@builtfor_example.module'

How to use it

Presenter

For example in your main module's class getContent method.

  // Load context for PsBilling
  $billingFacade = $this->getService('ps_billings.facade');

  // Remove this if you don't need to set an image
  $partnerLogo = $this->getLocalPath() . ' views/img/partnerLogo.png';

  // Billing
  Media::addJsDef($billingFacade->present([
      'logo' => $partnerLogo,
      'tosLink' => 'https://yoururl/',
      'privacyLink' => 'https://yoururl/',
      'emailSupport' => 'you@email',
  ]));

Contribute

Pre-commit Hook: Code Validation with PHP-CS-Fixer

This project uses a pre-commit hook to ensure the code follows the standards defined by PHP-CS-Fixer. Before each commit, the hook automatically performs a check and blocks the commit if any style issues are detected.

Installation

The hook is automatically installed when you run one of the following commands:

# Install dependencies
$ composer install

# Update dependencies
$ composer update

How It Works

During a commit (git commit), the hook runs:

PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix

Troubleshooting

  • Manually reinstall the hook: If the hook is not installed or was removed, you can reinstall it manually by running:

    bash scripts/install-hooks.sh
  • Bypass the hook temporarily: If you need to bypass the hook for a specific commit, use the --no-verify option:

    git commit --no-verify

    ⚠️ Note: Use this option cautiously, as it skips all pre-commit checks.

Automatic tests

Install

Please follow theses steps to launch unit tests

# Needs to have wget, for OS without wget pleae see the official website (or just visit this link)
PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;")
if [[ ${PHP_VERSION} -gt "72" ]]; then
  wget -O phpunit https://phar.phpunit.de/phpunit-9.phar
else
  wget -O phpunit https://phar.phpunit.de/phpunit-8.phar
fi

chmod +x phpunit

# Should display the version
./phpunit --version

Run

./phpunit tests

Introduce a breaking change in module-lib-billing

PrestaShop module system is not able to handle multiple version of the same library.

Here is an example:

  • Module A requires the v1 of a libA
  • Module B requires the v2 of this same libA

If someone install module A then module B, only the v1 of libA will be loaded for both Module A and Module B.

Workaround

When introducing a breaking change to a class or method signature, you should instead create a new class rather to changing the existing one.

By creating a new class it will force the autoloader to use the last version of the lib.

prestashopcorp/module-lib-billing 适用场景与选型建议

prestashopcorp/module-lib-billing 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31.44k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 02 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 prestashopcorp/module-lib-billing 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 31.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 17
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-16