opensearch-project/opensearch-php
opensearch-php is a community-driven, open source PHP client for OpenSearch, forked from elasticsearch-php and licensed under Apache 2.0. It lets PHP applications index, search, and manage data in OpenSearch clusters.
Architecture fit. opensearch-project/opensearch-php is the official, community-maintained PHP client for OpenSearch, forked from elasticsearch-php and licensed Apache 2.0 per the repository. Architecturally it is a thin, transport-agnostic REST wrapper: a ClientBuilder composes an endpoint factory with a PSR-18 HTTP client (Guzzle and Symfony factories are now provided) and exposes generated endpoint classes (index, search, bulk, PIT, ml-commons, SQL, etc.). It is an SDK, not a framework integration — there is no service provider, facade, config file, Eloquent/query-builder layer, or Laravel Scout engine in the package. That is a good fit for Laravel's container and its existing Guzzle dependency, but it means we own every integration seam ourselves.
Integration feasibility. Straightforward mechanically: composer require opensearch-project/opensearch-php, bind a configured Client as a singleton, drive config from config/services.php + env. The real constraint is version gates. Release 2.6.0 raises the minimum to PHP 8.2, which is fine for Laravel 11/12 but forces a PHP upgrade if any service is still on Laravel 10 / PHP 8.1. There is also an explicit deprecation path: connection pools, selectors, and callable endpoints are deprecated in favor of PSR HTTP clients with retries, and several namespaces (async_search, searchable_snapshots, ssl, monitoring, data_frame_transform_deprecated) plus legacy exceptions are slated for removal in 3.0.0. Any integration built on the old configuration style will need rework at the next major.
Technical risk.
NOASSERTION while README/LICENSE state Apache 2.0. Low substantive risk, but legal sign-off should confirm before we make it a platform dependency.elasticsearch-php.Key questions.
auth_aws Guzzle/Symfony factory path is on the critical path.COMPATIBILITY.md cover that matrix?Stack fit. Composer package, PSR-18/PSR-7/PSR-3 interfaces, works cleanly with Laravel's container and with the Guzzle that Laravel already ships. Recommended shape: a SearchServiceProvider that binds OpenSearch\Client as a singleton built from config, plus a narrow internal interface (SearchRepository / IndexWriter) that domain code depends on. Keeping the vendor client behind our own interface is the single highest-leverage decision here — it insulates us from the 3.0.0 namespace removals, from a hypothetical swap to elasticsearch-php or a Scout driver, and it makes the client testable with a fake.
Migration path. Three realistic entry points:
elasticsearch-php: near drop-in for the older, pre-PSR API — namespace rename, dependency swap, endpoint/config review. Budget time for the deprecated connection pool/selector patterns, which should be replaced with PSR-client retry configuration rather than ported as-is.Compatibility. Pin to ^2.6 with a committed lockfile, do not float to ^3. Verify PHP 8.2+, verify the OpenSearch server version against COMPATIBILITY.md, and confirm the chosen HTTP client factory (Guzzle vs Symfony) matches what the framework already installs. Where Scout is required, validate the chosen engine's compatibility with OpenSearch's API surface rather than assuming Elasticsearch parity.
Sequencing.
info and one search against a dev cluster; confirm auth mode (basic vs SigV4) and TLS.SearchRepository interface with a fake implementation for tests.Maintenance. Upstream cadence is brisk and automated (release automation to Packagist, changelog verification workflow, spec-driven API regeneration). Expect a steady stream of minor releases with large but mostly mechanical diffs. Recommend Renovate/Dependabot with grouped PRs, a staging smoke test against a real cluster as the upgrade gate, and a rule that major-version bumps get a dedicated ticket rather than riding an automated PR. The generated-code nature means phpstan baselines and pinned static analysis may need refresh alongside upgrades.
Support. Community-supported through the OpenSearch forums and GitHub, with no commercial SLA from the project itself; AWS support applies only if we run Amazon OpenSearch Service. Internally we need a named owner for the PHP integration and a separate owner for the cluster — conflating them is the most common failure mode for search features. Document the version pin, auth mode, and index naming conventions in the team runbook.
Scaling. Client-side scaling is essentially a non-issue — it is a serializer plus an HTTP call, and horizontal scale follows PHP-FPM/queue workers. Real scaling levers live in the cluster (shards, replicas, refresh interval, mappings) and in ingestion design: use the bulk API with bounded chunk sizes, run reindex/backfill on dedicated queue workers, tune connection reuse and keep-alive on the PSR client, and use PIT rather than unbounded from/size for deep pagination. Avoid designing around client-level async; queued jobs are the reliable concurrency primitive.
Failure modes to instrument for.
items. Must be parsed and alerted on, otherwise silent data loss.size caps, _source filtering, and streaming/chunked reads for exports.Ramp-up. Client wiring is a one-to-two-day task for a mid-level PHP developer; the interface wrapper plus tests is roughly a sprint-week. The actual learning curve is OpenSearch domain knowledge — mappings, analyzers, shard sizing, query DSL, relevance tuning — not this package. Plan for one engineer to own search end-to-end and budget two to three weeks before they are independently productive on tuning work. Because the ecosystem around this specific client is sparse, expect to read the client source and the OpenSearch REST docs directly rather than finding framework-specific tutorials.
How can I help you explore Laravel packages today?