omnipay/common
Framework-agnostic core for Omnipay payment gateways. Provides shared interfaces, request/response handling, HTTP client integration, and common utilities used by gateway drivers so apps can add and swap payment providers with a consistent API.
Gateway, Request, and Response interfaces, improving modularity.laravel-omnipay).Http client if not configured carefully.Omnipay\GatewayInterface to concrete gateways).payment.succeeded, payment.failed) via Laravel Events.guzzlehttp/guzzle (Omnipay’s default HTTP client).Gateway/Request/Response in unit tests.omnipay/omnipay-laravel) to bridge gaps.Http client entirely, or coexist?Response objects to Laravel’s exception handling (e.g., PaymentFailedException)?Payment facade for fluent syntax (e.g., Payment::stripe()->purchase()).Guzzle client (configure via Omnipay\Common\Http\ClientInterface).Http client (requires custom ClientInterface implementation).Response objects to store transaction data in Laravel models (e.g., PaymentTransaction).Omnipay\Tests\TestCase as a base for PHPUnit tests.Gateway and Request objects with Laravel’s Mockery or PHPUnit.| Phase | Action | Tools/Libraries |
|---|---|---|
| Assessment | Audit existing payment logic for coupling to specific providers. | Static analysis (PHPStan), code reviews. |
| Abstraction | Refactor provider-specific code into Omnipay Gateway implementations. |
omnipay/stripe, omnipay/paypal. |
| Integration | Bind Omnipay to Laravel’s container and configure HTTP client. | Laravel Service Providers, config/omnipay.php. |
| Testing | Replace direct API tests with Omnipay’s mockable interfaces. | PHPUnit, Pest. |
| Deployment | Roll out behind feature flags; monitor performance. | Laravel Horizon (for async jobs). |
omnipay/stripe) are compatible with omnipay/common@^4.0.composer.override.Http + Omnipay’s Guzzle).Request/Response objects simplify provider swaps.purchase(), refund()).| Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Provider API Outage | Payment failures | Implement retries with exponential backoff. |
| Omnipay Version Conflict | Integration breaks | Use composer.lock and CI checks. |
| Gateway-Specific Bug | Partial functionality loss | Fallback to direct API calls if needed. |
| Laravel Cache Issues | Stale gateway configurations | Use distributed cache (Redis) for critical data. |
| Webhook Failures | Unprocessed transactions | Queue webhook handlers with retries. |
How can I help you explore Laravel packages today?