- Can I use this bundle directly in Laravel, or do I need Symfony?
- This bundle is built for Symfony, so it won’t work out-of-the-box in Laravel. However, you can integrate it by using Laravel’s Symfony Bridge or wrapping Symfony-specific components (like the ContainerInterface) with Laravel facades or adapters. For a smoother experience, consider abstracting dependencies like the HTTP client or Doctrine ORM.
- Which payment gateways does this bundle support, and can I switch them?
- The bundle primarily integrates with Brazilian gateways like Mercado Pago and Stone. While it’s designed for these providers, the architecture appears modular enough to swap gateways if you abstract the gateway service behind an interface. This would require custom development but allows flexibility for testing or multi-region support.
- How do I handle payment webhooks or notifications in Laravel?
- The bundle likely uses Symfony’s event system for notifications. In Laravel, you can map these events to Laravel’s event system by creating listeners that trigger on Symfony events. For webhooks, use Laravel’s route middleware or queue jobs to process asynchronous notifications, ensuring idempotency and retries for failed transactions.
- Does this bundle support asynchronous payment processing (e.g., Laravel Queues)?
- The bundle doesn’t explicitly mention Laravel Queues, but you can adapt it for async processing by dispatching payment requests to a queue (e.g., using Laravel’s `dispatch()`) and processing them later. For webhook handling, ensure your queue workers are robust to handle retries and failed jobs.
- What Laravel versions are compatible with this bundle after migration?
- Since this bundle is Symfony-focused, compatibility depends on how well you abstract Symfony dependencies. Laravel 8+ is recommended due to its improved dependency injection and Symfony bridge support. Test thoroughly with your target Laravel version, as some Symfony components may have version-specific quirks.
- How do I configure this bundle in Laravel if it uses Symfony’s YAML/XML config?
- Convert Symfony’s configuration files (YAML/XML) to Laravel’s PHP-based config files (e.g., `config/pagamento.php`). Use Laravel’s `config()` helper to access settings, and replace Symfony’s parameter bag with Laravel’s environment variables or config cache. This step is critical for seamless integration.
- Does this bundle handle PCI DSS compliance or Brazilian tax laws (e.g., NF-e)?
- The bundle focuses on payment processing but doesn’t explicitly mention PCI DSS compliance or Brazilian tax laws like NF-e. You’ll need to implement additional logic or middleware to ensure compliance, such as encrypting sensitive data or logging transactions for audits. Consult Brazilian tax regulations for NF-e requirements.
- Are there alternatives to this bundle for Laravel that support Brazilian payments?
- For Laravel, consider packages like `laravel-pagamento` or `omnipay/omnipay` with Brazilian gateways (e.g., Mercado Pago, Stone). These are more Laravel-native and may offer better integration with Eloquent and Laravel’s ecosystem. Evaluate based on your need for PIX, Boleto, or credit card support.
- How do I test payment workflows locally without hitting real gateways?
- Mock the payment gateway services by creating fake implementations of the gateway interfaces (e.g., using Laravel’s `Mockery` or PHPUnit). Replace the real HTTP client with a mock that returns predefined responses for success/failure scenarios. Test webhook handling with Laravel’s `HttpTests` or queue jobs for async flows.
- What’s the best way to migrate this bundle to Laravel if I’m not using Symfony?
- Start by abstracting Symfony-specific dependencies: replace `ContainerInterface` with Laravel’s `Container`, wrap Symfony’s `HttpClient` behind a PSR-18 interface (e.g., Guzzle), and use Eloquent or a repository pattern for Doctrine entities. Gradually replace Symfony events with Laravel events and adapt configuration files. Document each step to ensure maintainability.