- What Laravel versions does omniphx/forrest support?
- The package supports Laravel 6.x through 13.x, as explicitly stated in its documentation and version badges. Always check the [latest release notes](https://github.com/omniphx/forrest/releases) for minor version compatibility if upgrading or downgrading.
- How do I authenticate with Salesforce using OAuth 2.0 in Laravel?
- Forrest leverages Laravel’s OAuth 2.0 capabilities. Configure your Salesforce Connected App with the correct callback URI, then set `SF_CONSUMER_KEY`, `SF_CONSUMER_SECRET`, and `SF_CALLBACK_URI` in your `.env`. The package handles token management, including refreshes, via Laravel’s cache or a dedicated service like Redis.
- Can I sync Salesforce data with Eloquent models in Laravel?
- Yes, Forrest provides Eloquent model synchronization, but you must explicitly define field mappings in your model. This ensures control over data structure but requires upfront configuration. Use the `syncWithSalesforce()` method or custom queries for flexible data handling.
- How do I handle token refreshes for Salesforce OAuth in production?
- Forrest automatically refreshes expired tokens using Laravel’s cache. For production, monitor token expiration via Laravel Horizon or a cron job to trigger `auth:refresh` if needed. Ensure your Salesforce Connected App includes the `refresh_token` scope for long-lived access.
- Does omniphx/forrest support real-time Salesforce updates via webhooks?
- Yes, Forrest supports real-time sync using Salesforce Platform Events. Configure your Salesforce org to send events to your Laravel app’s endpoint, then use the `listenForEvents()` method in Forrest to process updates asynchronously via Laravel queues.
- How can I mock Salesforce API responses for testing in Laravel?
- Use Laravel’s HTTP testing tools like `Http::fake()` to mock Salesforce API responses. For complex scenarios, consider packages like `spatie/fake-salesforce` to create realistic test doubles. Forrest’s fluent interface makes it easy to test both REST and SOAP interactions.
- What are the risks of hitting Salesforce governor limits with this package?
- Governor limits (e.g., SOQL rows, DML statements) can be hit if not monitored. Forrest supports batch processing, but you must configure batch sizes and use Laravel queues to avoid timeouts. Implement logging or tools like Laravel Horizon to track API usage and set alerts for limits.
- Can I use omniphx/forrest for bulk data operations in Salesforce?
- Yes, Forrest supports bulk API calls via the `bulk()` method. For large datasets, use Laravel queues to process batches asynchronously. Monitor governor limits and adjust batch sizes (e.g., 200 records per batch) to avoid failures. Consider using Salesforce’s Bulk API for very large operations.
- How do I handle schema changes in Salesforce that break my Laravel models?
- Forrest includes a `schema:validate` Artisan command to check for schema drift between Salesforce and your Laravel models. Run this command regularly after Salesforce updates. For automated validation, integrate it into your CI/CD pipeline or use Laravel’s `model:refresh` events.
- Are there alternatives to omniphx/forrest for Laravel-Salesforce integration?
- Alternatives include `salesforce/apex-rest-client` (low-level PHP SDK) or `spatie/laravel-salesforce` (simpler but less feature-rich). Forrest stands out for its Laravel-native integration (facades, events, queues) and support for REST, SOAP, and Apex APIs in one package. Choose based on your need for flexibility vs. simplicity.