- How do I install algolia/algoliasearch-client-php in a Laravel project?
- Install it with Composer using composer require algolia/algoliasearch-client-php "^4.0". The package requires PHP 8.0 or newer, so confirm your runtime and CI images satisfy that before installing. Once installed, create a client with SearchClient::create('<YOUR_APP_ID>', '<YOUR_API_KEY>') and start calling methods such as saveObject or search.
- Does algolia/algoliasearch-client-php require any PHP extensions?
- Yes. Starting with 4.50.0 the package declares ext-zlib in composer.json, so the zlib extension must be present wherever Composer runs. Because it is a hard install-time requirement, a missing extension makes composer install or update fail outright rather than throwing a runtime error. Verify zlib is available in your Docker images, CI runners, and Forge, Vapor, or Envoyer build steps before upgrading.
- What are the breaking changes in version 4.50.0 I should review before upgrading?
- The release notes flag three breaking areas: the new ext-zlib runtime requirement, A/B Testing V3 where pValue is now optional, and reshaped Agent Studio models including renamed tool config classes and removed memory request models. Because 4.50.0 only documents its own delta, review the 4.44 through 4.49 changelogs too before pinning. Treat this as a minor-version bump with major semantics and test any A/B testing, Agent Studio, or Composition API code paths.
- Is this package a replacement for Laravel Scout?
- No. This is a thin, low-level HTTP client for Algolia's API, not an Eloquent integration. Laravel Scout, or algolia/scout-extended, is still the right choice for syncing models and driving searchable behaviour. Use this client directly when you need fine-grained control such as custom indexing payloads, advanced queries, or hybrid search.
- How do I use the Algolia client with Laravel's service container?
- Bind Algolia\AlgoliaSearch\Api\SearchClient as a singleton in a service provider, resolving your app ID and API key from config or environment variables. Then type-hint SearchClient in controllers, jobs, or services and let the container inject it. This keeps credentials out of your code and makes it straightforward to swap in a fake during tests.
- Does the client automatically retry when Algolia returns HTTP 429?
- Yes. Version 4.50.0 adds built-in wait-and-retry behaviour on HTTP 429 that honours the Retry-After header, which removes much of the custom retry plumbing previously needed around RetryStrategy. The tradeoff is less predictable job duration, so set your queue timeouts and retry_after values above the maximum backoff the client may consume. Also consider isolating search-heavy work into dedicated queues.
- Will the client work behind a load balancer, nginx, or a WAF?
- It is significantly friendlier than before. Requests now send bodies with Content-Length instead of chunked encoding, which removes friction with nginx, AWS ALBs, and WAFs that buffer or reject chunked bodies. That is a net positive for typical Laravel deployments sitting behind a proxy or ingress.
- How should I test code that depends on the Algolia client?
- Because the client is a thin HTTP wrapper, the cleanest approach is to bind a stub or fake implementation of SearchClient in Laravel's container for your test suite. That lets you assert which index and payloads your application would send without hitting the Algolia API. Keep a small number of real integration tests against a dedicated test index for confidence in the actual request shapes.
- Is Agent Studio or A/B testing affected if I only use basic search features?
- For most Laravel search applications these changes are a no-op. The Agent Studio breaking changes, such as AgentCompletionRequestUnion and the renamed or merged tool config models, only matter if you build conversational AI features on top of Algolia. The A/B Testing V3 change, where pValue became optional, only affects code that reads or exports A/B test models.
- How actively is algolia/algoliasearch-client-php maintained, and how should I pin it?
- The client ships frequent minor releases and routine dependency bumps, and the 4.50.0 upgrade came only seven minor versions after 4.43.1. Review changelogs before each bump and treat minor releases with breaking declarations as upgrade candidates rather than drop-in updates. Pin your Guzzle and Symfony HTTP Client versions to avoid transitive conflicts with Laravel 10 and 11.