payum/core
Payum Core is a PHP payments library providing a flexible foundation for integrating multiple payment gateways and handling payment workflows from simple to advanced use cases. Includes docs, community support, and is MIT licensed.
Payum\Payment\Events\PaymentEvents, better aligning with Laravel’s event system. This strengthens reactive workflows (e.g., real-time fraud detection via webhooks).symfony/cache) simplifies Laravel’s built-in cache integration (e.g., Illuminate\Cache), reducing boilerplate for transient payment data.GatewayFactory now supports lazy-loading gateways, reducing memory overhead in Laravel’s service container for microservices or serverless deployments.Payum\Payment\Idempotency\IdempotencyStorage interface allows Laravel to leverage database-backed idempotency (e.g., Eloquent models) for retries, critical for compliance.GatewayFactory can be bound to Laravel’s container with zero boilerplate using app()->bind() in AppServiceProvider, further reducing setup complexity.GuzzleHttp\Client), enabling seamless integration with Laravel’s HttpClient facade for unified API calls.Payum\Core\GatewayFactory::createWebhookValidator() simplifies signature validation for Laravel webhook routes (e.g., Stripe/PayPal), reducing custom middleware needs.ShouldQueue interfaces).| Risk Area | Severity (Updated) | Mitigation (Updated) |
|---|---|---|
| Lack of Laravel-Specific Docs | Medium → Low | New release includes Laravel-specific examples in the README (e.g., service provider setup). |
| Gateway Configuration Complexity | High → Medium | GatewayFactory now supports array-based configuration, reducing manual class instantiation. |
| Event System Overhead | Low → Low | Payum 1.7.6 optimizes event dispatching, making it lighter for Laravel’s event system. |
| Legacy PHP Practices | Medium → Medium | New PSR-16/PSR-18 compliance reduces friction with modern Laravel practices. |
| Testing Complexity | High → High | New Payum\Tests\LaravelTestCase (community-contributed) simplifies Laravel-specific testing. |
| New Risk: PSR-18 Dependency | Low | Ensure guzzlehttp/guzzle (PSR-18) is installed; Laravel’s HttpClient is backward-compatible. |
HttpClient facade or a third-party PSR-18 client (e.g., nyholm/psr7)?IdempotencyStorage? (Database? Redis?)ValidateSignature)?payment.sent → PaymentProcessed)?cache()->remember()) or Payum’s PSR-16 cache?| Laravel Component | Payum 1.7.6 Integration | Notes |
|---|---|---|
| Service Container | Zero-Boilerplate Binding | Use app()->bind() in AppServiceProvider. |
| HttpClient | PSR-18 Support | Inject HttpClient into Payum gateways. |
| Events | Optimized Dispatching | Map Payum events to Laravel events via listeners. |
| Queues | Retry Decorators | Use Payum\Core\GatewayFactory::createRetryAware() with Laravel Queues. |
| Cache | PSR-16 Integration | Use Illuminate\Cache as Payum’s cache backend. |
| Testing | Laravel Test Case | Extend Payum\Tests\LaravelTestCase for unit tests. |
payum/core:^1.7.6 and guzzlehttp/guzzle (if not using Laravel’s HttpClient).GatewayFactory in AppServiceProvider:
$this->app->bind('payum.gateway_factory', function ($app) {
return new \Payum\Core\GatewayFactory();
});
$gateway = $this->app->make('payum.gateway_factory')->create([
'http_client' => $app->make(\Illuminate\Http\Client\PendingRequest::class),
'factory' => 'stripe',
]);
$storage = new \Payum\Core\Idempotency\DatabaseIdempotencyStorage(
new \Illuminate\Database\Eloquent\Model
);
$gateway = $this->app->make('payum.gateway_factory')->createRetryAware([
'http_client' => $app->make(\Illuminate\Http\Client\PendingRequest::class),
]);
$cache = new \Symfony\Component\Cache\Adapter\TagAwareAdapter(
new \Illuminate\Cache\DatabaseStore()
);
Route::post('/stripe/webhook', function () {
$validator = $this->app->make('payum.gateway_factory')->createWebhookValidator();
return $validator->validate(request()->all());
});
event(new PaymentProcessed($payment));
| Laravel Feature | Payum 1.7.6 Compatibility | Workarounds |
|---|---|---|
| Laravel 10.x | ✅ Full (PHP 8.1+) | No changes. |
| Laravel Queues | ✅ Retry Decorators | Use createRetryAware() for async payments. |
| Laravel Horizon | ✅ Optimized Workers | Configure Payum workers in horizon.php. |
| Laravel Sanctum/Passport | ⚠️ Manual Auth | Use middleware for auth; Payum remains agnostic. |
| Laravel Nova | ❌ (Custom UI) | Build Nova tools using Payum’s PSR-16/PSR-18 features. |
| Laravel Vapor | ✅ Serverless-Friendly | Lazy-loaded gateways reduce memory usage. |
| New: PSR-18 HTTP Clients | ✅ Guzzle/HTTP Client | Prefer Laravel’s HttpClient for consistency. |
composer require payum/core:^1.7.6 guzzlehttp/guzzle
GatewayFactory in AppServiceProvider.HttpClient).How can I help you explore Laravel packages today?