PHPackages                             spackleso/spackle-php - 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. [Payment Processing](/categories/payments)
4. /
5. spackleso/spackle-php

ActiveLibrary[Payment Processing](/categories/payments)

spackleso/spackle-php
=====================

Spackle is the easiest way to integrate your PHP app with Stripe Billing. See https://www.spackle.so for details.

0.0.8(2y ago)029MITPHP

Since Apr 8Pushed 2y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (10)Used By (0)

Spackle PHP Library
===================

[](#spackle-php-library)

The Spackle PHP library provides optimized access to billing aware flags created on the Spackle platform.

Documentation
-------------

[](#documentation)

See the [PHP API docs](https://docs.spackle.so/php).

Setup
-----

[](#setup)

### Install the Spackle library

[](#install-the-spackle-library)

```
composer require spackleso/spackle-php
```

To use the bindings use Composer's autoload:

```
require_once('vendor/autoload.php');
```

### Configure your environment

[](#configure-your-environment)

In order to use Spackle, you need to configure your secret key on the `Spackle` singleton. You can find your secret key in Spackle app [settings page](https://dashboard.stripe.com/settings/apps/so.spackle.stripe).

```
\Spackle\Spackle::setApiKey('');
```

Usage
-----

[](#usage)

### Pricing tables

[](#pricing-tables)

#### Fetch a pricing table

[](#fetch-a-pricing-table)

```
\Spackle\PricingTable::retrieve("abcde123");
```

#### Pricing table object

[](#pricing-table-object)

```
{
  id: string
  name: string
  intervals: string[]
  products: {
    id: string
    name: string
    description: string
    features: {
      id: string
      name: string
      key: string
      type: number
      value_flag: boolean
      value_limit: number | null
    }[]
    prices: {
      month?: {
        id: string
        unit_amount: number
        currency: string
      }
      year?: {
        id: string
        unit_amount: number
        currency: string
      }
    }
  }[]
}
```

### Entitlements

[](#entitlements)

#### Fetch a customer

[](#fetch-a-customer)

Spackle uses stripe ids as references to customer features.

```
$customer = \Spackle\Customer::retrieve("cus_000000000");
```

#### Verify feature access

[](#verify-feature-access)

```
$customer->enabled("feature_key");
```

#### Fetch a feature limit

[](#fetch-a-feature-limit)

```
$customer->limit("feature_key");
```

#### Examine a customer's subscriptions

[](#examine-a-customers-subscriptions)

A customer's current subscriptions are available on the `subscriptions` method. These are valid `\Stripe\Subscription` objects as defined in the [Stripe PHP library](https://stripe.com/docs/api/subscriptions/object?lang=php).

```
$customer->subscriptions();
```

#### Waiters

[](#waiters)

There is a brief delay between when an action takes place in Stripe and when it is reflected in Spackle. To account for this, Spackle provides a `Waiters` class with static methods that can be used to wait for a Stripe object to be updated and replicated.

1. Wait for a customer to be created ```
    \Spackle\Waiters::waitForCustomer("cus_00000000");
    ```
2. Wait for a subscription to be created ```
    \Spackle\Waiters::waitForSubscription("cus_000000000", "sub_00000000");
    ```
3. Wait for a subscription to be updated ```
    \Spackle\Waiters::waitForSubscription("cus_000000000", "sub_00000000", array("status" => "active"));
    ```

These will block until Spackle is updated with the latest information from Stripe or until a timeout occurs.

#### Usage in development environments

[](#usage-in-development-environments)

In production, Spackle requires a valid Stripe customer. However, that is not development environments where state needs to be controlled. As an alternative, you can use a file store to test your application with seed data.

```
/app/spackle.json

{
  "cus_000000000": {
    "features": [
      {
        "type": 0,
        "key": "flag_feature",
        "value_flag": true
      },
      {
        "type": 1,
        "key": "limit_feature",
        "value_limit": 100
      }
    ],
    "subscriptions": [
      {
        "id": "sub_000000000",
        "status": "trialing",
        "quantity": 1
      }
    ]
  }
}
```

Then configure the file store in your application:

```
\Spackle\Spackle::setStore(new \Spackle\Stores\FileStore("/app/spackle.json"));
```

#### Usage in testing environments

[](#usage-in-testing-environments)

In production, Spackle requires a valid Stripe customer. However, that is not ideal in testing or some development environments. As an alternative, you can use an in-memory store to test your application with seed data.

```
\Spackle\Spackle::setStore(new \Spackle\Stores\MemoryStore());
\Spackle\Spackle::getStore()->set_customer_data("cus_000000000", array(
  "features" => array(
    array(
      "type" => 0,
      "key" => "flag_feature",
      "value_flag" => true
    ),
    array(
      "type" => 1,
      "key" => "limit_feature",
      "value_limit" => 100
    )
  ),
  "subscriptions" => array(
    array(
      "id" => "sub_000000000",
      "status" => "trialing",
      "quantity" => 1
    )
  )
);
```

**Note:** The in-memory store is not thread-safe and state will reset on each application restart.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~43 days

Recently: every ~60 days

Total

9

Last Release

787d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c9ad3441ce6c07c76341ec40b5be8602a5bb1a491810ba88b0528b92443a7cd?d=identicon)[hclarke](/maintainers/hclarke)

---

Top Contributors

[![hunterclarke](https://avatars.githubusercontent.com/u/806604?v=4)](https://github.com/hunterclarke "hunterclarke (17 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spackleso-spackle-php/health.svg)

```
[![Health](https://phpackages.com/badges/spackleso-spackle-php/health.svg)](https://phpackages.com/packages/spackleso-spackle-php)
```

###  Alternatives

[spatie/laravel-stripe-webhooks

Handle stripe webhooks in a Laravel application

5213.1M8](/packages/spatie-laravel-stripe-webhooks)[tightenco/nova-stripe

A tool to create a quick Stripe dashboard in your Laravel Nova admin panels

110308.9k](/packages/tightenco-nova-stripe)[duncanmcclean/simple-commerce

A simple, yet powerful e-commerce addon for Statamic.

16313.2k2](/packages/duncanmcclean-simple-commerce)[flux-se/payum-stripe

Payum Stripe gateways

29407.5k4](/packages/flux-se-payum-stripe)[payum/stripe

The Payum extension. It provides Stripe payment integration.

22573.1k3](/packages/payum-stripe)[craftcms/commerce-stripe

Stripe integration for Craft Commerce 5.0+

32157.4k3](/packages/craftcms-commerce-stripe)

PHPackages © 2026

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