- Can I use BlackOptic/XeroBundle in Laravel, or is it only for Symfony2?
- This bundle is designed for Symfony2 and won’t work natively in Laravel. For Laravel, consider alternatives like the official Xero PHP SDK or a custom Guzzle wrapper. If you’re tied to Symfony2, this bundle is a solid choice for Xero API integration.
- What Laravel version does BlackOptic/XeroBundle support?
- This bundle does not support Laravel directly—it’s built for Symfony2. If you’re using Laravel 5.5+, you’ll need to either fork the bundle for Laravel compatibility or use a standalone Guzzle client with Xero’s OAuth2 library.
- How do I securely store my Xero private key in production?
- Never hardcode private keys in config files. Use environment variables (e.g., `.env` in Laravel) or a secrets manager like AWS Secrets Manager, HashiCorp Vault, or Laravel’s built-in encryption for sensitive credentials.
- Does BlackOptic/XeroBundle handle Xero API rate limits automatically?
- The bundle doesn’t include built-in rate limit handling, but you can implement retries with exponential backoff using Guzzle middleware. For high-frequency requests, consider caching responses or using Xero’s API batch endpoints.
- What’s the best way to test Xero API calls with this bundle?
- Mock the `blackoptic.xero.client` service in your tests using Symfony’s DI container or Laravel’s service container. For Laravel, you may need to create a custom wrapper service that mimics the bundle’s interface for testing.
- Will this bundle work with Laravel’s service container?
- No, this bundle is tightly coupled to Symfony2’s service container. For Laravel, you’d need to manually register the Guzzle client and OAuth2 logic or adapt the bundle’s codebase to Laravel’s container (e.g., using Laravel’s `bind()` method).
- Are there alternatives to BlackOptic/XeroBundle for Laravel?
- Yes. For Laravel, consider the official [Xero PHP SDK](https://github.com/XeroAPI/xero-php), which supports Laravel natively, or build a custom Guzzle client with the [xero-php/oauth2](https://github.com/XeroAPI/xero-php-oauth2) library.
- How do I handle OAuth2 token refreshes with this bundle?
- The bundle automates OAuth2 authentication, but token refreshes depend on Xero’s API. If tokens expire, the bundle will throw an exception. Implement a retry mechanism or listen for `401 Unauthorized` errors to refresh tokens programmatically.
- Does BlackOptic/XeroBundle support Xero’s newer API endpoints (e.g., v3)?
- The bundle’s compatibility with Xero API versions depends on its last update. Check the [GitHub repository](https://github.com/james75/XeroBundle) for version support. If it lacks v3 support, you may need to extend the bundle or use Xero’s official SDK.
- How do I log Xero API responses for debugging in Laravel?
- Since this bundle isn’t Laravel-native, intercept the Guzzle client’s responses by extending the service or wrapping it in a Laravel middleware. Use Laravel’s logging facade (`Log::debug()`) to log requests/responses for debugging.