- Can I use this bundle directly in Laravel without Symfony, or is it strictly for Symfony projects?
- This bundle is officially designed for Symfony projects, but you can integrate it into Laravel by leveraging Symfony’s components (like dependency injection) or using a compatibility layer. The bundle relies on Symfony’s container and services, so direct Laravel integration may require additional setup or shims. For Laravel-specific Algolia solutions, consider the standalone Scout Extended package.
- What Laravel versions are supported by this bundle, and how does Symfony compatibility affect me?
- This bundle is built for Symfony 7/8 and requires PHP 8.2+. While it isn’t natively Laravel-specific, you can use it in Laravel by installing Symfony’s dependency-injection container or adopting a hybrid approach. The bundle’s core functionality (search, indexing) works independently of Laravel’s framework, but Symfony’s DI system may need adaptation for Laravel’s service container.
- How do I migrate from Algolia PHP SDK v3 to v4 with this bundle, and what are the breaking changes?
- The bundle now uses Algolia PHP SDK v4, which introduces breaking changes like moving `SearchClient` to the `Api` namespace and restructuring request options (headers must be wrapped in an array). The `UPGRADE-8.1.md` guide provides detailed steps, including replacing `SearchServiceResponse::wait()` calls and updating namespace imports. Test thoroughly, as some edge cases (e.g., custom middleware) may still require adjustments.
- Does this bundle support real-time indexing for Eloquent models, or is it just for manual search queries?
- The bundle itself focuses on search and indexing via Algolia’s API, not Laravel Eloquent integration. For real-time model indexing, pair it with Laravel Scout or Scout Extended, which handle Eloquent model synchronization with Algolia. This bundle provides the low-level search infrastructure, while Scout manages the Laravel-specific logic.
- How do I configure custom request options (e.g., headers, tags) in this bundle for advanced Algolia features?
- Custom request options are passed via the `$requestOptions` parameter in search/index methods. For headers, wrap them in an array under the `headers` key (e.g., `['headers' => ['X-Algolia-API-Key' => 'key']]`). Tags, custom parameters, or other options are added similarly. Refer to the [Algolia PHP SDK docs](https://github.com/algolia/algoliasearch-client-php) for supported options.
- Is there a way to test this bundle locally without hitting Algolia’s production API?
- Yes, use Algolia’s local testing environment by configuring a mock index or leveraging the `ALGOLIA_APP_ID` and `ALGOLIA_API_KEY` environment variables to point to a sandbox index. The bundle supports all standard Algolia API methods, so you can test search, indexing, and analytics locally. For CI/CD, use temporary credentials or a dedicated test index.
- What are the performance implications of using this bundle in production, and how does it compare to Scout Extended?
- This bundle is optimized for low-latency search queries, with SDK v4 introducing potential performance improvements (e.g., optimized network calls). For Laravel, Scout Extended may offer better integration with Eloquent and caching layers. Benchmark your use case: this bundle excels for custom search logic, while Scout Extended simplifies model-based indexing. Monitor query times and API call efficiency in staging before production.
- Are there any known issues with caching or rate limits when using this bundle at scale?
- The bundle itself doesn’t enforce caching or rate limits, but Algolia’s API handles rate limits automatically. For caching, implement Laravel’s cache layer (e.g., Redis) for search results or use Algolia’s [cache headers](https://www.algolia.com/doc/guides/sending-and-managing-queries/cache-headers/). Monitor your Algolia dashboard for rate limit alerts and adjust batch sizes or query frequency as needed.
- Can I extend or override the bundle’s services (e.g., SearchClient) to add custom logic?
- Yes, the bundle follows Symfony’s service container patterns, allowing you to override or extend services via configuration. For example, define a custom `search_client` service in `config/services.yaml` or use dependency injection to inject your logic. The `SearchClient` is type-hinted, so you can subclass it or replace it entirely while maintaining compatibility with the bundle’s interfaces.
- What alternatives exist for Laravel Algolia integration, and when should I choose this bundle over them?
- For Laravel, alternatives include **Scout Extended** (for Eloquent model indexing) or **Algolia’s official Laravel Scout driver**. Choose this bundle if you need Symfony’s robustness, advanced search features (e.g., custom analytics), or are already using Symfony components. Use Scout Extended if you prioritize seamless Eloquent integration. For standalone PHP projects, the raw [Algolia PHP SDK](https://github.com/algolia/algoliasearch-client-php) is another option.