stripe-php

Stripe's official PHP library for the Stripe API

SDK
Composer
vv21.3.0-alpha.1
4,017stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
93/100Excellent
Development Activity92
Maintenance88
Community92
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture82
Code Quality85
Innovation70
Learning Curve75

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
72%
MIT

Bagisto

Analytics · Ecommerce

27,983

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
69
Dependency
Built with
PHP72%
Blade22%
Updated today
PHP
79%
Apache 2.0

Coolify

Devops · Hosting Control Panel

60,738

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
72
Dependency
Built with
PHP79%
Blade18%
Updated yesterday
JavaScript
70%
AGPL 3.0

Fleetbase

Logistics

2,510

Modular open-source logistics and supply chain operating system

View details
91
Repo Health
75
Technical
68
Dependency
Built with
JavaScript70%
PHP10%
Updated today
PHP
57%
Other

Hi.Events

Ecommerce · Scheduling

3,985

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

View details
88
Repo Health
84
Technical
67
Dependency
Built with
PHP57%
TypeScript37%
Updated 6 days ago
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,008

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
PHP85%
XSLT10%
Updated 2 days ago
PHP
48%
AGPL 3.0

Leantime

Productivity · Project Management · Collaboration

11,391

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

View details
90
Repo Health
68
Technical
67
Dependency
Built with
PHP48%
CSS20%
Blade17%
Updated 4 days 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

Search