ssk · smisco 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 VCS repository.
Not on Packagist. Add the kit's public GitHub repository as a Composer VCS repository, require it, and install — no local checkout needed.
- Add the VCS repository and require the package in your app's composer.json:
{ "repositories": [ { "type": "vcs", "url": "https://github.com/grimblefritz/smisco-subscription-kit.git" } ], "require": { "smisco/subscription-kit": "^0.4" } }Releases are SemVer-tagged (v0.4.0, …) for Composer; pin the constraint as you would any dependency.
- Install:
composer update smisco/subscription-kit
- Local development (optional) — editing the kit alongside your app? Clone it as a sibling and use a path repository instead, so edits reflect without re-tagging:
{ "repositories": [ { "type": "path", "url": "../smisco-subscription-kit/public" } ], "require": { "smisco/subscription-kit": "@dev" } }
documentation
Read the full story.
Rendered in your browser, straight from the package's own docs.