tuurbo/spreedly 问题修复 & 功能扩展

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

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

tuurbo/spreedly

最新稳定版本:2.7.0

Composer 安装命令:

composer require tuurbo/spreedly

包简介

Spreedly API

README 文档

README

changelog !! As of the 2.0 release the amount must be an integer as required by Spreedly. E.g., 1098 for $10.98 !!

Getting Started

Setup/Install

Install through Composer.

composer require tuurbo/spreedly 

Laravel 4 or 5 Setup

Next, update app/config/app.php to include a reference to this package's service provider in the providers array and the facade in the aliases array.

'providers' => [ ... 'Tuurbo\Spreedly\SpreedlyServiceProvider' ] 'aliases' => [ ... 'Spreedly' => 'Tuurbo\Spreedly\SpreedlyFacade' ]

Login to your Spreedly account to retrieve your api credentials. You can set your default gateway once you've created your first gateway.

Add to app/config/services.php config file.

return [ ... 'spreedly' => [ 'key' => '', // (required) Environment key 'secret' => '', // (required) Signing Secret 'gateway' => '', // (required) Default gateway 'timeout' => '', // (optional) Default 64 seconds (recommended by Spreedly) 'connect_timeout' => '', // (optional) Default 10 seconds ] ];

Default Setup (Non Laravel)

$config = [ 'key' => '', // (required) Environment key 'secret' => '', // (required) Signing Secret 'gateway' => '', // (required) Default gateway 'timeout' => '', // (optional) Default 64 seconds (recommended by Spreedly) 'connect_timeout' => '', // (optional) Default 10 seconds ]; $spreedly = new Tuurbo\Spreedly\Spreedly($config); // The amount must be an integer as per required by Spreedly. E.g., 1098 for $10.98. $resp = $spreedly->payment($paymentToken)->purchase(1098);

Example response handling

// If the call to Spreedly is successful if ($resp->success()) { return $resp->response(); // $resp->transactionToken(); // $resp->paymentToken(); // $resp->message(); } // If the call to Spreedly fails or payment declines if ($resp->fails()) { // returns array return $resp->errors(); // returns list of errors as a string return $resp->errors(true); }

More Docs

Gateways

Payment Methods

Transactions

Quick list of all methods

NOTE: Many of the methods below return multiple tokens. Be sure when storing tokens, you store the correct ones for later use.

// Gateway calls. Spreedly::gateway()->setup(); Spreedly::gateway()->all(); Spreedly::gateway()->show(); Spreedly::gateway()->create(); Spreedly::gateway()->disable(); Spreedly::gateway()->update(); Spreedly::gateway()->transactions(); // If using multiple gateways, you can set the gateway token before the payment call. Spreedly::gateway()->payment()->purchase(); Spreedly::gateway()->payment()->authorize(); // Uses default gateway. Spreedly::payment()->all(); Spreedly::payment()->create(); Spreedly::payment()->update(); Spreedly::payment()->disable(); Spreedly::payment()->retain(); Spreedly::payment()->recache(); Spreedly::payment()->store(); Spreedly::payment()->get(); Spreedly::payment()->transactions(); Spreedly::payment()->purchase(); Spreedly::payment()->authorize(); Spreedly::payment()->verify(); Spreedly::payment()->generalCredit(); // Transaction calls Spreedly::transaction()->all(); Spreedly::transaction()->get(); Spreedly::transaction()->referencing(); Spreedly::transaction()->transcript(); Spreedly::transaction()->purchase(); Spreedly::transaction()->void(); Spreedly::transaction()->credit(); Spreedly::transaction()->capture(); Spreedly::transaction()->complete();

Development

Clone the repo and run npm install. This will composer install.

Testing

Tests are in the spec directory. They are written with phpspec.

To run your tests, simply do npm test. If you don't want to use npm, that's fine, simply run vendor/bin/phpspec run

Please ensure you have added proper test coverage for each Pull Request.

Changelog

2.4+

See releases page https://github.com/tuurbo/spreedly/releases

2.3

  • added support for laravel 5.4

2.2

  • added ability to merge configs.

2.1

  • changed default timeout from 15 seconds to 64 seconds as recommended by Spreedly.
  • added timeout method to change timeout per api call. E.g., Spreedly::timeout(25)->payment()->purchase().
  • added new Tuurbo\Spreedly\Exceptions\TimeoutException for catching timeouts.

2.0

  • amount is no longer converted to cents.
    • the amount must be an integer as required by Spreedly. E.g., 1098 for $10.98
  • switched from Spreedly xml api to json api.
  • renamed ->declined() method to ->message().

tuurbo/spreedly 适用场景与选型建议

tuurbo/spreedly 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 151.28k 次下载、GitHub Stars 达 19, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 tuurbo/spreedly 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 19
  • Watchers: 5
  • Forks: 24
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04