wemakecustom/stripe-bundle
A Symfony bundle that integrates Stripe payments into your application, wrapping the Stripe PHP SDK in configurable services. It simplifies payment processing, webhook handling, and API access through Symfony's service container and configuration system.
Verdict up front: for a new Laravel app, do not install this bundle. It is a Symfony 2 bundle with no Laravel auto-discovery, no service provider, no facade, and dependency constraints that will fight modern Laravel. Install stripe/stripe-php directly and write a small Laravel service provider. Use this package as a reference for how to structure configuration and service wiring, not as a runtime dependency.
If you are maintaining a legacy Symfony 2 application, the minimal path is:
composer require wemakecustom/stripe-bundleapp/AppKernel.php:
new WemakeCustom\Bundle\StripeBundle\WemakeCustomStripeBundle(),
app/config/config.yml — check DependencyInjection/Configuration.php for the exact root key and available options (typically API key, API version, and possibly public key).app/config/parameters.yml / environment-specific config, never in the bundle config committed to the repo.$this->container->get(...) directly.Where to look first:
README.md for the documented config key and service id.DependencyInjection/Configuration.php for the real config schema.Resources/config/services.xml (or YAML) for the service ids and constructor arguments.Tests/ for the expected usage shape and mocked Stripe interactions.For a Laravel developer evaluating it, the mapping is:
| Symfony 2 bundle concept | Laravel equivalent |
|---|---|
Bundle registration in AppKernel |
Package auto-discovery / manual ServiceProvider |
services.xml service definitions |
Container bindings in register() |
| Bundle config tree | config/stripe.php |
parameters.yml |
.env + config() |
| Event dispatcher listeners | Laravel events/listeners or jobs |
If you want to reuse the bundle's ideas in Laravel, copy the config shape and the thin wrapper approach into a StripeServiceProvider, and bind Stripe\StripeClient (or a small StripeGateway class) as a singleton.
Inject a wrapper, not the SDK everywhere. The bundle's main value is that it centralizes Stripe client construction. In Laravel, mirror that: bind one StripeClient or StripeGateway singleton in a service provider, configure it from config('services.stripe.secret'), and inject that into controllers, jobs, and listeners. Avoid scattering new \Stripe\StripeClient(...) across the codebase.
Keep Stripe calls behind an application service. Create something like App\Services\Billing\StripeGateway with methods such as charge(), createCustomer(), refund(), and createSubscription(). This is the same reason the Symfony bundle exposes a service instead of letting controllers touch the SDK: it gives you one place to mock, log, retry, and change API versions.
Configuration per environment. In Symfony 2, the bundle expects keys from parameters.yml; in Laravel, use config/services.php plus .env. Never let production and test keys share the same config path. Use Stripe test keys locally and in CI.
Webhook handling. The bundle does not remove the need for a webhook endpoint. In Symfony, you would add a route and controller that receives the raw body and verifies the Stripe signature. In Laravel, do the same with a route that bypasses CSRF and reads $request->getContent(). Verify the signature with the current stripe/stripe-php helper, then dispatch a job. Treat webhook handlers as idempotent: Stripe can deliver the same event more than once.
Use events/listeners for post-payment side effects. Rather than putting email sending, provisioning, or invoice updates inside the controller after a charge, dispatch a domain event (PaymentSucceeded, SubscriptionCancelled) and handle it in listeners or queued jobs. This mirrors Symfony's event dispatcher pattern and keeps the Stripe integration thin.
Testing pattern. Mock your own gateway interface, not the Stripe SDK. If you must test against Stripe, use test keys and Stripe's test card numbers. For the Symfony bundle, the existing tests likely mock the SDK service; follow that pattern rather than hitting the network.
Laravel bridge pattern, if you insist on using the bundle. You can manually register the bundle's service definitions in a Laravel service provider by loading its XML/YAML config and binding the service id, but this is usually more work than rewriting the ~50 lines of wiring yourself. The bundle's service definitions assume Symfony's container features and may not resolve cleanly in Laravel's container.
Extension point. In Symfony, the bundle's compiler pass or service definition can be overridden in services.yml. In Laravel, the equivalent extension point is your own service provider: bind an interface to your gateway and swap the implementation in tests or across environments.
extra.laravel block, no service provider, and no facade. You must wire everything manually, and the bundle's Symfony-specific classes will not autoload usefully in a Laravel app.stripe/stripe-php. Exception classes, method signatures, and object properties have changed. Code copied from the bundle may use Stripe\Error\Card instead of modern Stripe\Exception\CardException, or may assume pre-StripeClient static calls.1000. This is an easy source of off-by-100 bugs, especially when copying examples.parameters.yml is often committed. Keep Stripe secret keys in environment variables or an untracked parameters file. In Laravel, use .env and never commit it.Log::withContext() around gateway calls.How can I help you explore Laravel packages today?