- How do I install and set up the LionTech Laravel package?
- Run `composer require nokimaro/liontech-laravel` to install. Add your LionTech credentials (e.g., `LIONTECH_ACCESS_TOKEN`) to your `.env` file. The package auto-discovers and registers itself, so no manual `config/app.php` changes are needed. For optional config publishing, run `php artisan vendor:publish --tag=liontech-config`.
- Does this package support Laravel 13?
- Yes, the package is fully compatible with Laravel 11–13 and requires PHP 8.3+. It leverages Laravel’s auto-discovery feature, so no additional configuration is needed for modern Laravel versions. Always check the latest release notes for version-specific updates.
- How do I handle webhook verification in LionTech?
- The package includes a `WebhookSignatureVerifier` to validate incoming webhook signatures using your `LIONTECH_WEBHOOK_PUBLIC_KEY`. Ensure this key is correctly set in your `.env` file. For security, always verify signatures before processing webhook payloads to prevent spoofing.
- Can I use this package for multi-tenant applications?
- Yes, but you’ll need to manually instantiate the `PaymentsClient` for each tenant using their specific credentials. The package doesn’t enforce multi-tenancy out of the box, so you’ll need to handle token refreshes and error scenarios (e.g., failed API calls) manually. Consider using Laravel’s context binding for cleaner tenant-specific logic.
- What’s the best way to test LionTech integrations in Laravel?
- Use Laravel’s mocking tools (e.g., Mockery or `partialMock`) to simulate SDK responses in unit tests. Avoid testing against the real LionTech API in CI to keep tests fast. For webhook testing, use the sandbox environment (`LIONTECH_SANDBOX=true`) and verify signatures with mock public keys.
- How do I handle PCI compliance with card encryption?
- The package includes a `CardEncryptor` that uses RSA encryption via the underlying SDK to meet PCI DSS requirements. Ensure your `LIONTECH_CARD_ENCRYPTION_PUBLIC_KEY` is securely stored and rotated as needed. The package itself doesn’t manage key rotation, so implement a process to update keys in your `.env` or secure storage.
- What happens if the LionTech API is down or unresponsive?
- The package doesn’t include built-in retry logic or circuit breakers. You’ll need to implement these manually (e.g., using Laravel’s `retry` helper or a package like `spatie/laravel-queueable-retries`) to handle transient failures. Consider logging failures and notifying your team for proactive issue resolution.
- Is there a facade or should I use dependency injection?
- The package provides both a `LionTech` facade for quick access (e.g., `LionTech::payments()->create()`) and dependency injection for granular control. Use the facade for simplicity in controllers or blades, but prefer DI in services or tests for better testability and mocking.
- How do I migrate from a custom LionTech integration to this package?
- Replace direct API calls (e.g., `Http::post()`) with the package’s facade or DI methods (e.g., `LionTech::payments()->create()`). Update your webhook routes to include signature verification using the `WebhookSignatureVerifier`. For existing orders or data, ensure your database schema aligns with the SDK’s response structures.
- What are the risks of using an unofficial LionTech Laravel package?
- Since this is a community-maintained package, there’s a risk of abandonment or delays in updates if LionTech changes its API or SDK. Monitor the GitHub repository for issues and updates, and consider contributing or forking the package if maintenance becomes a concern. Always back up your integration logic.