Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Core Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Enhanced Event System: Payum 1.7.6 introduces improved event dispatching with Payum\Payment\Events\PaymentEvents, better aligning with Laravel’s event system. This strengthens reactive workflows (e.g., real-time fraud detection via webhooks).
  • PSR-16 Cache Integration: Native support for PSR-16 caching (e.g., symfony/cache) simplifies Laravel’s built-in cache integration (e.g., Illuminate\Cache), reducing boilerplate for transient payment data.
  • Gateway Factory Improvements: The GatewayFactory now supports lazy-loading gateways, reducing memory overhead in Laravel’s service container for microservices or serverless deployments.
  • Idempotency Enhancements: New Payum\Payment\Idempotency\IdempotencyStorage interface allows Laravel to leverage database-backed idempotency (e.g., Eloquent models) for retries, critical for compliance.

Integration Feasibility

  • Laravel Service Provider Synergy: The updated GatewayFactory can be bound to Laravel’s container with zero boilerplate using app()->bind() in AppServiceProvider, further reducing setup complexity.
  • HTTP Client Flexibility: Payum now supports PSR-18 HTTP clients (e.g., GuzzleHttp\Client), enabling seamless integration with Laravel’s HttpClient facade for unified API calls.
  • Webhook Validation: New Payum\Core\GatewayFactory::createWebhookValidator() simplifies signature validation for Laravel webhook routes (e.g., Stripe/PayPal), reducing custom middleware needs.
  • Queue Integration: Async payment processing is now more resilient with built-in job retry decorators, aligning with Laravel’s queue system (e.g., ShouldQueue interfaces).

Technical Risk

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.

Key Questions (Updated)

  1. PSR-18 HTTP Client Strategy:
    • Will we use Laravel’s HttpClient facade or a third-party PSR-18 client (e.g., nyholm/psr7)?
  2. Idempotency Storage:
    • How will we implement IdempotencyStorage? (Database? Redis?)
  3. Webhook Validation:
    • Will we use Payum’s built-in validator or Laravel middleware (e.g., ValidateSignature)?
  4. Event Dispatching:
    • Should we map Payum events to Laravel events (e.g., payment.sentPaymentProcessed)?
  5. Cache Strategy:
    • Will we use Laravel’s cache (e.g., cache()->remember()) or Payum’s PSR-16 cache?
  6. Gateway Lazy Loading:
    • Should we enable lazy-loading gateways in Laravel’s container to optimize memory?

Integration Approach

Stack Fit (Updated)

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.

Migration Path (Updated)

  1. Phase 1: Core Integration (Updated)
    • Install payum/core:^1.7.6 and guzzlehttp/guzzle (if not using Laravel’s HttpClient).
    • Bind GatewayFactory in AppServiceProvider:
      $this->app->bind('payum.gateway_factory', function ($app) {
          return new \Payum\Core\GatewayFactory();
      });
      
  2. Phase 2: Payment Workflows (Updated)
    • Use PSR-18 HTTP client for gateways:
      $gateway = $this->app->make('payum.gateway_factory')->create([
          'http_client' => $app->make(\Illuminate\Http\Client\PendingRequest::class),
          'factory' => 'stripe',
      ]);
      
    • Leverage idempotency storage (e.g., Eloquent model):
      $storage = new \Payum\Core\Idempotency\DatabaseIdempotencyStorage(
          new \Illuminate\Database\Eloquent\Model
      );
      
  3. Phase 3: Async & Scaling (Updated)
    • Enable retry decorators for queues:
      $gateway = $this->app->make('payum.gateway_factory')->createRetryAware([
          'http_client' => $app->make(\Illuminate\Http\Client\PendingRequest::class),
      ]);
      
    • Use PSR-16 cache for transient data:
      $cache = new \Symfony\Component\Cache\Adapter\TagAwareAdapter(
          new \Illuminate\Cache\DatabaseStore()
      );
      
  4. Phase 4: Advanced Features (Updated)
    • Implement webhook validation middleware:
      Route::post('/stripe/webhook', function () {
          $validator = $this->app->make('payum.gateway_factory')->createWebhookValidator();
          return $validator->validate(request()->all());
      });
      
    • Map Payum events to Laravel events:
      event(new PaymentProcessed($payment));
      

Compatibility (Updated)

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.

Sequencing (Updated)

  1. Prerequisites (Updated):
    • Laravel 10.x (PHP 8.1+).
    • Composer dependencies:
      composer require payum/core:^1.7.6 guzzlehttp/guzzle
      
    • Basic Payum gateway configuration (e.g., Stripe).
  2. Order of Implementation (Updated):
    • Step 1: Bind GatewayFactory in AppServiceProvider.
    • Step 2: Configure a PSR-18 HTTP client (Laravel’s HttpClient).
    • Step 3: Implement idempotency storage (e.g., database).
    • Step 4: Set
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor