FakerPHP Stripe Provider


May 26th, 2023

FakerPHP Stripe Provider

Faker Stripe is a provider for FakerPHP that generates fake but structurally correct IDs for Stripe API resources. Stripe has quite a few different resource types, but this package has well over 50+ different faker methods:

// pi_KiAjc3WFzvswIhq8IkCLXNBW
// acct_xBXg7yyrSyQVbsjM
// fca_z3JzQ1OCkYved5uWOqh3b387

This package easily integrates with PestPHP, PHPUnit, and Eloquent: Factories:

// Pest example
beforeEach(function () {
$this->fake = fake();
$this->fake->addProvider(new Stripe($this->fake));
it('shows an example', function () {
$this->fake->stripeConnectAccountId() // acct_xBXg7yyrSyQVbsjM
// Laravel factory example
use WithFaker;
public function definition(): array
$this->faker->addProvider(new Stripe($this->faker));
$this->faker->stripeConnectAccountId(); // acct_xBXg7yyrSyQVbsjM

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.