stripe-php

Stripe's official PHP library for the Stripe API

SDK
Composer
vv21.4.0-alpha.5
4,021 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
94 /100 Excellent
Development Activity 92
Maintenance 92
Community 92
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
78 /100 Good
Architecture 82
Code Quality 85
Innovation 70
Learning Curve 75

stripe-php is the officially maintained PHP client for the Stripe API, providing typed resource classes (Charge, Customer, Subscription, PaymentIntent, and hundreds more) that initialize dynamically from API responses. This dynamic-initialization design keeps the library forward-compatible with new Stripe API fields and versions without requiring a release for every API change.

The library covers the full breadth of Stripe’s product surface — Payments, Billing, Connect, Checkout, Climate, Apps, and more — organized into namespaced resource classes that mirror the API’s structure. It ships with configurable retry logic, webhook signature verification, and idempotency-key support, making it the standard entry point for PHP applications integrating Stripe.

What You Get

  • Typed PHP classes for nearly every Stripe API resource (Charges, Customers, Subscriptions, PaymentIntents, Connect accounts, and more)
  • A configurable StripeClient with automatic retries, timeouts, and idempotency-key support
  • Built-in webhook signature verification via Webhook::constructEvent
  • Support for pinning a specific Stripe API version per request or client
  • Auto-pagination helpers for list endpoints via the Collection class
  • PHPStan static analysis baseline and strict typing for safer integration

Common Use Cases

  • Processing one-off and recurring payments (Charges, PaymentIntents, Subscriptions) from a PHP backend
  • Building marketplace or platform payouts using Stripe Connect
  • Verifying and handling incoming Stripe webhook events securely
  • Implementing Stripe Checkout or Billing Portal sessions from server-side PHP code

Under The Hood

Architecture - The library is organized as a large, generated set of resource classes under lib/ (460+ PHP files), each subclassing shared ApiResource/ApiOperations traits (create, retrieve, update, delete, list) that funnel every request through a central ApiRequestor. Domain areas like Billing, Connect, Checkout, Climate, and Apps are grouped into their own subdirectories, mirroring the Stripe API’s own namespacing, while cross-cutting concerns (retries, telemetry, error mapping) live in BaseStripeClient and ApiRequestor.

Tech Stack - Built for PHP 7.2+ (moving toward dropping the oldest supported versions), it depends only on standard PHP extensions (curl, json, mbstring) with no heavyweight external dependencies, keeping installs lightweight in typical Composer-based PHP stacks. Development tooling includes PHPUnit for tests, PHP-CS-Fixer for style, and PHPStan (with a maintained baseline file) for static analysis.

Code Quality - The tests/ directory mirrors lib/’s resource structure with dedicated test classes per resource, and the repo tracks OPENAPI_VERSION/CODEGEN_VERSION files, indicating the resource classes are generated from Stripe’s OpenAPI spec rather than hand-maintained — reducing drift between the API and the SDK. A phpstan-baseline.neon shows static analysis is enforced incrementally on top of a large, mostly-generated codebase.

API Design - Resources follow a consistent Stripe\ResourceName::method() pattern (e.g. Stripe\Charge::create(), Stripe\Customer::retrieve()), and the dynamic-initialization approach means new API fields surface automatically without waiting for a new SDK release. The main developer-experience trade-off is the sheer size of the surface area — with hundreds of resource classes across nested namespaces, discoverability leans heavily on Stripe’s external API reference docs rather than the code alone.

Used by 6 apps in this directory

PHP
73%
MIT

Bagisto

Analytics · Ecommerce

28,186

Open-source Laravel eCommerce platform for building multi-vendor marketplaces, B2B stores, headless commerce, and AI-powered storefronts.

View details
93
Repo Health
75
Technical
67
Dependency
Built with
PHP 73%
Blade 21%
Updated 1 weeks ago
PHP
81%
Apache 2.0

Coolify

Devops · Hosting Control Panel

62,328

Open-source self-hosted PaaS — deploy apps, databases and 280+ services on your own servers with no vendor lock-in

View details
92
Repo Health
86
Technical
70
Dependency
Built with
PHP 81%
Blade 16%
Updated 5 days ago
JavaScript
69%
AGPL 3.0

Fleetbase

Logistics

3,940

Modular open-source logistics and supply chain operating system

View details
93
Repo Health
75
Technical
68
Dependency
Built with
JavaScript 69%
PHP 11%
Updated 4 days ago
PHP
58%
Other

Hi.Events

Ecommerce · Scheduling

4,037

Self-hosted event ticketing platform that keeps your attendee data, brand, and revenue completely under your control.

View details
88
Repo Health
84
Technical
66
Dependency
Built with
PHP 58%
TypeScript 36%
Updated 1 weeks ago
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,123

Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.

View details
97
Repo Health
83
Technical
62
Dependency
Built with
PHP 85%
Updated 1 weeks ago
PHP
48%
AGPL 3.0

Leantime

Collaboration · Productivity · Project Management

11,672

Project management built for ADHD, autism, and dyslexia — simple as Trello, powerful as Jira

View details
90
Repo Health
68
Technical
65
Dependency
Built with
PHP 48%
CSS 20%
Blade 17%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers