kinetis / search-opensearch
Fiber-native non-blocking OpenSearch client construction for Kinetis, via kinetis/revolt-http-client's Revolt-backed HTTP transport.
Requires
- php: ^8.4
- kinetis/framework: ^1.2.5
- kinetis/revolt-http-client: ^1.1.2
- opensearch-project/opensearch-php: ^2.6.0
- symfony/http-client: ^8.1.4
Requires (Dev)
- infection/infection: ^0.35.0
- phpstan/phpstan: ^2.2.8
- phpunit/phpunit: ^12.5.33
- vimeo/psalm: ^6.16.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
kinetis/search-opensearch
Non-blocking OpenSearch client construction for Kinetis
Part of Kinetis, a non-blocking PHP framework for API-first applications, developed in the kinetis-dev/kinetis monorepo.
Builds a real OpenSearch\Client (from opensearch-project/opensearch-php)
through OpenSearch's own TransportFactory/HttpTransport construction
path, with kinetis/revolt-http-client's Revolt-native HTTP transport
injected as its PSR-18 client instead of the default blocking one. The
returned object is the real, un-wrapped client — nothing Kinetis-specific
sits on top of it.
use Kinetis\SearchOpenSearch\OpenSearchClientFactory; $client = OpenSearchClientFactory::fromConfig($config); $client->index(['index' => 'articles', 'id' => '1', 'body' => ['title' => 'Kinetis']]); $results = $client->search(['index' => 'articles', 'body' => ['query' => ['match' => ['title' => 'Kinetis']]]]);
Provides
Installing this package auto-registers, via extra.kinetis:
- A container binding for
OpenSearch\Client, built byOpenSearchClientFactory::fromConfig()whenSEARCH_OPENSEARCH_HOSTis set. Unset means the package binds nothing. The binding is lazy, so an application that never searches never builds a transport.
Nothing else. Named connections stay explicit application wiring.
Configuration
SEARCH_OPENSEARCH_HOST=http://localhost:9200
| Key | Default | Purpose |
|---|---|---|
SEARCH_OPENSEARCH_HOST |
(required) | Base URI of the node. |
SEARCH_OPENSEARCH_USERNAME |
— | Basic-auth user. |
SEARCH_OPENSEARCH_PASSWORD |
— | Basic-auth password. |
SEARCH_OPENSEARCH_VERIFY_PEER |
true |
Verify the server certificate — false accepts a self-signed one on a security-enabled cluster. |
Every key is scoped — SEARCH_OPENSEARCH_HOST + logs →
SEARCH_LOGS_OPENSEARCH_HOST. Full reference:
kinetis.dev/docs/config.html.
SEARCH_OPENSEARCH_HOST is a single base URI, not a list — this
construction path has no multi-node selector/failover; put a load
balancer in front of a multi-node cluster instead.
fromConfig()'s optional $transportDecorator parameter wraps the
fully-configured PSR-18 client right before TransportFactory gets
it — the seam kinetis/telemetry's TracingOpenSearchTransport plugs
into, without duplicating this method's own config-reading logic.
Installation
composer require kinetis/search-opensearch
Requires PHP 8.4+, kinetis/framework, and kinetis/revolt-http-client.
Full documentation:
kinetis.dev/docs/search-opensearch.html.
License
MIT — see LICENSE.