jonpurvis / faker-stripe
Faker provider for generating fake Stripe IDs
Installs: 18 796
Dependents: 0
Suggesters: 0
Security: 0
Stars: 87
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: ^8.2
- fakerphp/faker: ^1.23
Requires (Dev)
- pestphp/pest: ^2.12
- pestphp/pest-plugin-faker: ^2.0
README
FakerPHP Stripe ID Provider
👋 Introduction
This package allows FakerPHP to generate fake IDs which have the same structure you can expect to be returned from Stripe. The wonderful Pest is used to run tests contained within this package, which requires a minimum PHP Version of 8.1.
✨Features
This package can currently generate fake IDs for the following Stripe resources. To avoid any confusion, the names of resources should match what's in this package.
Core Resources
Payment Methods
Products
Checkout
Payment Links
Billing
Connect
Fraud
Issuing
Terminal
Treasury
Entitlements
Sigma
Reporting
Financial Connections
Tax
Identity
Crypto
Climate
Forwarding
Webhooks
📚 Usage / Examples
Pest
it('generates a well structured stripe account id', function () { fake()->addProvider(new Stripe(fake())); expect(fake()->stripeConnectAccountId())->toStartWith('acct_')->toHaveLength(21)->toBeString(); });
PHPUnit
public function testGeneratesWellStructuredStripeAccountId() { $faker = Factory::create(); $faker->addProvider(new Stripe($faker)); $this->assertStringStartsWith('acct_', $faker->stripeConnectAccountId()); }
Laravel Factories
use WithFaker; public function definition(): array { $this->faker->addProvider(new Stripe($this->faker)); return [ 'id' => $this->faker->stripeConnectAccountId(), 'name' => 'John Doe', 'email' => 'john.doe@testing.co.uk' ]; }