PHPackages                             thekiharani/spreedly - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. thekiharani/spreedly

ActiveLibrary

thekiharani/spreedly
====================

Spreedly API

011PHP

Since Jan 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/thekiharani/spreedly)[ Packagist](https://packagist.org/packages/thekiharani/spreedly)[ RSS](/packages/thekiharani-spreedly/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

**[changelog](#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
===============

[](#getting-started)

Setup/Install
-------------

[](#setupinstall)

Install through Composer.

```
composer require fattmerchantorg/spreedly

```

#### Laravel 4 or 5 Setup

[](#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' => [
    ...
   'Fattmerchant\Spreedly\SpreedlyServiceProvider'
]

'aliases' => [
    ...
    'Spreedly' => 'Fattmerchant\Spreedly\SpreedlyFacade'
]
```

[Login](https://spreedly.com) 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)

[](#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 Fattmerchant\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
-------------------------

[](#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
---------

[](#more-docs)

### [Gateways](docs/gateways.md)

[](#gateways)

### [Payment Methods](docs/payment-methods.md)

[](#payment-methods)

### [Transactions](docs/transactions.md)

[](#transactions)

Quick list of all methods
-------------------------

[](#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
-----------

[](#development)

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

**Testing**

Tests are in the spec directory. They are written with [phpspec](https://www.phpspec.net/en/stable/).

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
---------

[](#changelog)

### 2.4+

[](#24)

See releases page

### 2.3

[](#23)

- added support for laravel 5.4

### 2.2

[](#22)

- added ability to merge configs.

### 2.1

[](#21)

- 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 `Fattmerchant\Spreedly\Exceptions\TimeoutException` for catching timeouts.

### 2.0

[](#20)

- 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()`.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 67.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f13bf32cb3eb3d056079daa40685a62d0007375a245a21656ab83e4cb36050a5?d=identicon)[thekiharani](/maintainers/thekiharani)

---

Top Contributors

[![tuurbo](https://avatars.githubusercontent.com/u/996899?v=4)](https://github.com/tuurbo "tuurbo (55 commits)")[![thekiharani](https://avatars.githubusercontent.com/u/44342484?v=4)](https://github.com/thekiharani "thekiharani (13 commits)")[![lasergoat](https://avatars.githubusercontent.com/u/15964?v=4)](https://github.com/lasergoat "lasergoat (4 commits)")[![matthewrobinsondotme](https://avatars.githubusercontent.com/u/84479007?v=4)](https://github.com/matthewrobinsondotme "matthewrobinsondotme (3 commits)")[![oradwell](https://avatars.githubusercontent.com/u/5054896?v=4)](https://github.com/oradwell "oradwell (2 commits)")[![jcherniak](https://avatars.githubusercontent.com/u/1727656?v=4)](https://github.com/jcherniak "jcherniak (1 commits)")[![adridev](https://avatars.githubusercontent.com/u/895348?v=4)](https://github.com/adridev "adridev (1 commits)")[![danielfosbery](https://avatars.githubusercontent.com/u/1961881?v=4)](https://github.com/danielfosbery "danielfosbery (1 commits)")[![andyfleming](https://avatars.githubusercontent.com/u/721038?v=4)](https://github.com/andyfleming "andyfleming (1 commits)")

### Embed Badge

![Health badge](/badges/thekiharani-spreedly/health.svg)

```
[![Health](https://phpackages.com/badges/thekiharani-spreedly/health.svg)](https://phpackages.com/packages/thekiharani-spreedly)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
