ssk · stripe subscription kit
Stripe subscriptions,
as a drop-in library.
A PHP library that wraps Stripe's whole subscription lifecycle — Checkout, Customer Portal, webhooks, access gating, admin operations — behind interfaces you implement. Your app supplies the database; the kit owns the Stripe logic.
// wire it up once, at boot $stripe = new StripeClient($secret, '2025-08-27'); $skus = new SkuConfig([/* code => price */]); // your DB lives behind these $users = new MyUserStore($db); $subs = new MySubscriptionStore($db); $events = new MyEventIdempotencyStore($db); $checkout = new CheckoutService($stripe, $skus, $users); $gate = new AccessGate(); $webhook = new WebhookReceiver($secret, $stripe, $skus, $events, $subs, $users);
the shape
Three layers, one seam.
Pure decision logic at the core, the Stripe SDK confined to a handful of service classes, and persistence pushed out to interfaces your app implements.
Pure logic
Value objects and decisions with no Stripe calls and no database — access gating, expiration banners, SKU config, subscription state.
Stripe services
The only code that touches the Stripe SDK: CheckoutService, PortalService, WebhookReceiver, AdminActions.
Host interfaces
Persistence is yours. Implement the subscription, user, and event-idempotency stores against whatever database you run — MySQL, Postgres, SQLite.
what it handles
The whole lifecycle.
Checkout through cancellation, with the webhook receiver keeping your local state in sync — signature verification and event de-duplication included.
install
A Composer path repository.
Not on Packagist. Clone the kit beside your app, point a path repository at its public/, and require it.
- Clone the kit next to your app (it is consumed as a sibling directory):
# beside your application, wherever that lives git clone https://github.com/grimblefritz/stripe-subscription-kit.git - Add the path repository and require the package in your app's composer.json:
{ "repositories": [ { "type": "path", "url": "../stripe-subscription-kit/public" } ], "require": { "simnuxco/subscription-kit": "@dev" } }Adjust the relative path to match your layout.
- Install:
composer update simnuxco/subscription-kit
documentation
Read the full story.
Rendered in your browser, straight from the package's own docs.