Download the PHP package spackleso/spackle-php without Composer
On this page you can find all versions of the php package spackleso/spackle-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download spackleso/spackle-php
More information about spackleso/spackle-php
Files in spackleso/spackle-php
Package spackle-php
Short Description Spackle is the easiest way to integrate your PHP app with Stripe Billing. See https://www.spackle.so for details.
License MIT
Informations about the package spackle-php
Spackle PHP Library
The Spackle PHP library provides optimized access to billing aware flags created on the Spackle platform.
Documentation
See the PHP API docs.
Setup
Install the Spackle library
To use the bindings use Composer's autoload:
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.
Usage
Pricing tables
Fetch a pricing table
Pricing table object
Entitlements
Fetch a customer
Spackle uses stripe ids as references to customer features.
Verify feature access
Fetch a feature limit
Examine a customer's 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.
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.
-
Wait for a customer to be created
-
Wait for a subscription to be created
- Wait for a subscription to be updated
These will block until Spackle is updated with the latest information from Stripe or until a timeout occurs.
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.
Then configure the file store in your application:
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.
Note: The in-memory store is not thread-safe and state will reset on each application restart.