定制 alphaolomi/php-cellulant 二次开发

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

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

alphaolomi/php-cellulant

Composer 安装命令:

composer require alphaolomi/php-cellulant

包简介

Cellulant PHP SDK

README 文档

README

Latest Version on Packagist Tests Total Downloads

Cellulant for PHP is a PHP client for the Tingg API a product of Cellulant.

Features

The package is centered around Custom Checkout APIs provided by Tingg. It provides the following features:

  • Checkout Request
  • Charge Request
  • Combined Checkout and Charge Request
  • Acknowledgement Request
  • Query Status
  • Refund Request
  • OTP Request and Validation

Installation

Pre-requisites

  • PHP >= 8.0
  • PHP cURL extension
  • Composer Package Manager
  • Cellulant API Credentials, obtain them from Tingg Dev Portal

Preferable way to install is with Composer.

You can install the package via Composer:

composer require alphaolomi/php-cellulant

Usage

use Alphaolomi\CellulantService;

$cellulant = new CellulantService([
    'clientId' => 'your clientId',
    'clientSecret' => 'your clientSecret',
    'apiKey' => 'your api key',
    'serviceCode' => 'your service code',
    'callbackUrl' => 'your callback url',
    'env' => 'sandbox', // or 'production' // default is sandbox
]);


// Authentication
// Get the access token
$authRes = $cellulant->authenticate();
// $authRes is an array with the following keys
// [
//  "token_type" => "bearer",
//  "expires_in" => 3600,
//  "access_token" => "WU3My1AHOcKsnxj3n",
//  "refresh_token" =>   "GSWtHRnJrMHBzdEFPbjhNS0FjODIwMTU1NVlTb3c9PQ=="
// ]

// Checkout Request
$checkoutRes = $cellulant->checkoutRequest([
    // ... Tingg Checkout Request Payload
]);

// Charge Request
$chargeRes = $cellulant->chargeRequest([
    // ... Tingg Charge Request Payload
]);

// Query Status
$queryRes = $cellulant->queryStatus([
    // ... Tingg Checkout Status Payload
]);

// Acknowledgement Request
$ackRes = $cellulant->acknowledgementRequest([
    // ... Tingg Acknowledgement Payload
]);

// Refund Request
$refundRes = $cellulant->refundRequest([
    // ... Tingg Refund Payload
]);

Refer to Features Test Cases for more usage examples.

Refer to Tingg API documentation for the required parameters reference for each method.

Notes

  • Calling authenticate() is not automatic, you have to call it manually before making any request.

  • Calling authenticate() will keep the accessToken in memory for subsequent requests.

  • Calling authenticate() only supports the client_credentials grant type. And will return an array with the following keys: token_type, expires_in, access_token, refresh_token.

  • Error handling is not yet implemented, so you have to handle errors manually.

  • Methods accept an array of parameters, which are then converted to JSON before making the request. Refer to Tingg API documentation for the required parameters.

  • Methods array parameters are NOT validated, so you have to make sure you pass the correct parameters. With exception of construct() method which validates the required parameters.

  • Method names are the same as the Tingg API endpoints.

  • The package uses Guzzle to make HTTP requests. Version ^7.0 is used.

  • Function Return Types are not implemented yet, so you have to manually cast the return values to the expected type.

Testing

Tests are written with Pest. To run the tests:

composer test

Support the development

Do you like this project? Support it by Star this repository ⭐️ and follow me on Twitter for more updates 👍.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Versioning

This project follows RomVer.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Alpha Olomi via alphaolomi@gmail.com. All security vulnerabilities will be promptly addressed.

Credits

Reaching Me

If you are having issues with this package, feel free to contact me on Twitter.

License

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

alphaolomi/php-cellulant 适用场景与选型建议

alphaolomi/php-cellulant 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 42 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 07 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-10