dahromy/mvola-bundle
Symfony bundle for integrating the MVola payment gateway. Provides MVola API authentication, services to initiate payments, check status and fetch transaction details, callback handling for notifications, plus configurable retries and token caching.
mvola.yaml mirrors Laravel’s .env + config/services.php approach, easing adoption for teams familiar with both./mvola/callback endpoint and event system can be mapped to Laravel’s route middleware + listeners (e.g., HandleMVolaCallback).MVolaService) would need manual binding.Event facade or third-party packages like symfony/event-dispatcher)..env + PHP config files).GET/POST; middleware would be needed).cache facade or symfony/cache).guzzlehttp/guzzle + raw MVola API calls) to avoid lock-in.symfony/event-dispatcher with Laravel’s Illuminate\Support\Facades\Event.%env(); Laravel uses .env. Ensure secure env variable handling (e.g., vlucas/phpdotenv).| Symfony Feature | Laravel Equivalent | Adaptation Notes |
|---|---|---|
| Bundles | Service Providers (AppServiceProvider) |
Register routes, bindings, and config manually. |
| EventDispatcher | Laravel Events (Event::dispatch()) |
Use symfony/event-dispatcher or Laravel’s native Event facade. |
| YAML Config | .env + config/services.php |
Migrate mvola.yaml to PHP config or .env with config() helper. |
| Dependency Injection | Laravel’s Container (app()->bind()) |
Manually bind MVolaService and dependencies. |
Routing (e.g., /mvola/callback) |
Laravel Routes (Route::put()) |
Add middleware to validate MVola’s signature (e.g., HMAC). |
| Cache | Laravel Cache (cache()->get()) |
Use symfony/cache or Laravel’s cache drivers. |
Phase 1: Core API Integration
MVolaService with a Laravel service class (e.g., app/Services/MVolaService.php).HttpClient.cache()->remember()).Phase 2: Callback Handling
/mvola/callback (PUT method).MVolaCallbackEvent) instead of Symfony’s EventDispatcher.MVolaCallbackListener) to process callbacks.Phase 3: Configuration
mvola.yaml with:
.env variables (e.g., MVOLA_MERCHANT_NUMBER).config/mvola.php) for non-sensitive settings.config() helper to load settings.Phase 4: Error Handling
throw new \RuntimeException()).CacheInterface) may need third-party packages or custom implementations.MVolaService (adapted for Laravel)..env + config/mvola.php simplifies environment management.symfony/event-dispatcher or symfony/cache increases vendor package count.EventDispatcher).MVolaService for Laravel").dahromy/mvola-laravel-bundle) to isolate changes.max_retries/retry_delay in config/mvola.php can be tuned for high-volume transactions./mvola/callback route is stateless (avoid long-running processes).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| MVola API downtime | Transactions fail | Implement exponential backoff and fallback notifications (email/SMS). |
| Callback route misconfiguration | Lost transaction updates | Use webhook verification (HMAC) and retry dead-letter queue. |
| Token cache invalidation | Authentication failures | Short cache_ttl (e.g., 30m) + real-time token refresh on 401 errors. |
| Laravel event listener crash | Unprocessed callbacks | Queue delayed jobs for callback |
How can I help you explore Laravel packages today?