Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Opensearch Php

Opensearch Php Laravel Package

opensearch-project/opensearch-php

Official PHP client for OpenSearch. Provides a convenient, low-level API for indexing and searching documents, managing clusters and indices, and calling OpenSearch endpoints from Laravel or any PHP app. Supports modern PHP versions and common auth options.

View on GitHub
Deep Wiki
Context7

Official PHP Client for OpenSearch

Frequently asked questions about Opensearch Php
How do I integrate this OpenSearch PHP client into a Laravel application?
Start by installing via Composer: `composer require opensearch-project/opensearch-php`. Register the client in a Laravel ServiceProvider by binding it to the IoC container with your OpenSearch host configuration. Use Laravel’s config files to manage settings like hosts, authentication, and retry logic dynamically.
Does this client support Laravel’s Eloquent ORM for hybrid search queries?
While the client doesn’t directly integrate with Eloquent, you can use its Query DSL to build complex searches and combine results with Eloquent data. Abstract the logic in a repository or facade to maintain clean separation between SQL and OpenSearch queries in Laravel.
What Laravel versions and PHP versions are officially supported?
The client supports modern PHP versions (8.1+), aligning with Laravel 9.x and 10.x. Check the package’s Composer requirements for exact PHP version constraints. Ensure your Laravel app’s PHP version matches to avoid deprecated feature conflicts, like `json_encode` flags.
How can I handle authentication for OpenSearch in Laravel, like AWS SigV4 or TLS certificates?
Configure authentication via the client’s `setBasicAuthentication()` or `setAWSOptions()` methods. For TLS, use `setSSLVerification()` and provide CA certificates. Store credentials securely in Laravel’s `.env` or use a secrets manager like AWS Secrets Manager or HashiCorp Vault.
Can I use this client for bulk indexing in Laravel, and how does it handle timeouts?
Yes, the client supports bulk operations via `BulkIndex` API. For Laravel, offload bulk indexing to queues (e.g., Laravel Horizon) to avoid timeouts. Configure retry logic in the client builder for transient failures, and monitor queue job retries for long-running operations.
What’s the best way to mock this client for unit testing in Laravel?
Use Laravel’s HTTP mocking (e.g., `Http::fake()`) or Mockery to stub the client’s HTTP transport layer. For integration tests, spin up a local OpenSearch instance via Docker (e.g., `opensearchproject/opensearch`). Test edge cases like rate limits (429 errors) and connection failures.
How does this client handle multi-cluster or failover scenarios in OpenSearch?
Configure multiple hosts in the client builder, and it will load-balance requests. For dynamic failover, update the host list via Laravel’s config or cache (e.g., Redis) and rebuild the client instance. Monitor cluster health using the client’s `ClusterInfo` API to detect topology changes.
Are there breaking changes when migrating from Elasticsearch’s PHP client to this OpenSearch client?
The API is largely compatible, but query syntax or endpoint paths may differ. Review the OpenSearch documentation for deprecated Elasticsearch features. Use a migration script to update queries and test thoroughly, especially for aggregations or security-related endpoints.
Can I cache search results or cluster metadata in Laravel with this client?
Yes, leverage Laravel’s cache drivers (Redis, Memcached) to store frequent search results or cluster metadata. Use the client’s `Info` API to cache schema or index mappings, reducing API calls. Set appropriate TTLs based on your data volatility.
What alternatives exist for OpenSearch in Laravel, and why choose this client?
Alternatives include unofficial Elasticsearch clients (e.g., `elasticsearch/elasticsearch`) or custom HTTP wrappers. This client is the **official** OpenSearch PHP library, ensuring compatibility with OpenSearch’s latest features, security updates, and performance optimizations. It also integrates seamlessly with Laravel’s service container and config system.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle