PHPackages                             randomstate/stripe - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. randomstate/stripe

ActiveLibrary[Payment Processing](/categories/payments)

randomstate/stripe
==================

A stripe wrapper for seriously easy testing

v1.2.0(6y ago)069[1 PRs](https://github.com/randomstate/stripe/pulls)1MITPHPCI passing

Since Sep 28Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/randomstate/stripe)[ Packagist](https://packagist.org/packages/randomstate/stripe)[ RSS](/packages/randomstate-stripe/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (17)Used By (1)

randomstate/stripe
==================

[](#randomstatestripe)

A stripe (PHP) wrapper for seriously easy testing. Brought to you with ❤️ from Random State.

> **This package is still being tested in real-life. I'm confident that it does what it says it does but there may still be a number of paths in the code that don't exactly fake over the stripe API.**

Installation
------------

[](#installation)

`composer require randomstate/stripe`

### Laravel

[](#laravel)

- Create a Service Provider object - e.g. `php artisan make:provider BillingServiceProvider`
- Add it into your app.php `providers` array
- Bind your billing provider

For Stripe:

```
public function register() {
    $this->app->bind(\RandomState\Stripe\BillingProvider::class, \RandomState\Stripe\Stripe::class);
    $this->app->bind(\RandomState\Stripe\Stripe::class, function() {
        return new \RandomState\Stripe\Stripe(env("STRIPE_SECRET"));
    });
}
```

For testing, you can bind the `BillingProvider` contract to `\RandomState\Stripe\Fake::class` and use it as if you were interacting with stripe.

Usage
-----

[](#usage)

Each provider conforms to the `BillingProvider` contract but essentially follows the natural way that the stripe API works.

E.g.

```
$stripe->charges()->create([
    'amount' => 100,
    // etc
])

$stripe->subscriptions()->items()->retrieve($itemId); // etc
```

Testing Helpers
---------------

[](#testing-helpers)

This package comes out of the box with the following helpful features:

- starting\_after, ending\_before and limit support during `all` queries
- Webhook spoofing using event data. In Laravel you might do something like this to fake webhook calls:

```
$webhooks = new WebhookListener($this->stripe->events());
$webhooks->record();

// perform actions

$events = $webhooks->play();

// Alternatively,
$events = $webhooks->during(function() {
    // perform actions
});

// Forward webhooks to your controllers in Laravel like so:
$webhooks->listen(function(Event $event) {
    $this->postJson('/my/webhooks/endpoint', $event->jsonSerialize());
});

$webhooks->during(function() {
     // perform actions and all events will be played automatically by sending the data as
     // a POST request to your webhook endpoint as defined above.
});
```

License
-------

[](#license)

MIT. Use at your own risk, we accept no liability for how this code is used.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance54

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Recently: every ~5 days

Total

14

Last Release

2266d ago

Major Versions

v0.1.10 → v1.0.02020-02-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/1204796510f0f912ac6f85359e20efbc78e573c00c742a3a53f509f3abdc7f9f?d=identicon)[CImrie](/maintainers/CImrie)

---

Top Contributors

[![byfoz](https://avatars.githubusercontent.com/u/3436576?v=4)](https://github.com/byfoz "byfoz (37 commits)")

---

Tags

laravelphpstripestripe-api

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/randomstate-stripe/health.svg)

```
[![Health](https://phpackages.com/badges/randomstate-stripe/health.svg)](https://phpackages.com/packages/randomstate-stripe)
```

###  Alternatives

[spatie/laravel-stripe-webhooks

Handle stripe webhooks in a Laravel application

5213.1M8](/packages/spatie-laravel-stripe-webhooks)[tightenco/nova-stripe

A tool to create a quick Stripe dashboard in your Laravel Nova admin panels

110308.9k](/packages/tightenco-nova-stripe)[duncanmcclean/simple-commerce

A simple, yet powerful e-commerce addon for Statamic.

16313.2k2](/packages/duncanmcclean-simple-commerce)[flux-se/payum-stripe

Payum Stripe gateways

29407.5k4](/packages/flux-se-payum-stripe)[payum/stripe

The Payum extension. It provides Stripe payment integration.

22573.1k3](/packages/payum-stripe)[craftcms/commerce-stripe

Stripe integration for Craft Commerce 5.0+

32157.4k3](/packages/craftcms-commerce-stripe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
