rebilly/client-php 问题修复 & 功能扩展

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

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

rebilly/client-php

Composer 安装命令:

composer require rebilly/client-php

包简介

Rebilly PHP Client

README 文档

README

Latest Version on Packagist Software License Total Downloads

The Rebilly SDK for PHP makes it easy for developers to access Rebilly REST APIs in their PHP code.

Requirements

  • PHP 8.0+.
  • CURL (verify peer requires a root certificate authority -- if you have not configured php curl to use one, and your system libs aren't linked to one, you may need to do a manual configuration to use the appropriate certificate authority)

Installation

Warning

This package does not follow semantic versioning, so minor version updates can cause backward compatibility breaks. Updates to the package should be tested before switching versions.

Using Composer is the recommended way to install the Rebilly SDK for PHP. To get started, you need run the Composer commands (assume you're in the project's root directory).

  • Install the latest stable version of the SDK:
composer require rebilly/client-php

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.

Supported Versions

The previous version of the SDK can be outdated and won't provide all (or the correct) specifications to communicate with the REST APIs. Only the latest version is constantly supported.

Version Supported Documentation
2.x ⚠️ (security fixes only) See tab PHP-SDK-2.0
3.x ✅ (current) See tab PHP

Quick Examples

Create a Rebilly Client

use Rebilly\Sdk\Client;
use Rebilly\Sdk\Service;

// Instantiate Rebilly client.
$client = new Client([
    'baseUrl' => Client::SANDBOX_HOST,
    'organizationId' => '{organizationId}',
    'apiKey' => '{secretKey}',
]);
$service = new Service(client: $client);

Create a Customer

use Rebilly\Sdk\Exception\DataValidationException;
use Rebilly\Sdk\Model\ContactObject;
use Rebilly\Sdk\Model\Customer;

$customer = Customer::from([])
    ->setWebsiteId('{websiteId}')
    ->setPrimaryAddress(
        ContactObject::from([])
            ->setFirstName('John')
            ->setLastName('Doe'),
    );

try {
  $customer = $service->customers()->create($form);
} catch (DataValidationException $e) {
  var_dump($e->getValidationErrors());
}

For more see examples directory.

Documentation

Read Rebilly REST APIs documentation for more details.

Migration from SDK v2.x to v3.x

This new major version brings several new helper classes to communicate with Rebilly REST APIs and some incompatibilities that should be tested before switching SDK versions.

  • Now, a Service class can be explicitly instantiated to make the API calls instead of using only the Client, as it encapsulates the API calls.

  • To simplify the migration from the previous version, the Client object can be used to make calls to any API directly. For example, instead of instantiating a service class, one can use:

    $client->customers()->create($form);
  • The namespace changed from Rebilly\Entities to Rebilly\Sdk\Model. Now, the src is Rebilly\Sdk.

  • The classes are now generated by an automated process that is triggered every time a new version of the API definitions is released. It means more frequency on the SDK updates, keeping it synced with the REST APIs.

rebilly/client-php 适用场景与选型建议

rebilly/client-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 417.68k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2014 年 01 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 rebilly/client-php 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 18
  • Watchers: 18
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-01-13