PHPackages                             flyokai/amp-opensearch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. flyokai/amp-opensearch

ActiveLibrary[HTTP &amp; Networking](/categories/http)

flyokai/amp-opensearch
======================

opensearch client connection handler backed with amphp/http-client

v1.1.7(1mo ago)028MITPHPPHP ^8.2

Since Apr 25Pushed 1mo agoCompare

[ Source](https://github.com/flyokai/amp-opensearch)[ Packagist](https://packagist.org/packages/flyokai/amp-opensearch)[ RSS](/packages/flyokai-amp-opensearch/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (6)Versions (15)Used By (0)

flyokai/amp-opensearch
======================

[](#flyokaiamp-opensearch)

> User docs → [`README.md`](README.md) · Agent quick-ref → [`CLAUDE.md`](CLAUDE.md) · Agent deep dive → [`AGENTS.md`](AGENTS.md)

> Async OpenSearch client for PHP — bridges the official `opensearch-project/opensearch-php` SDK with AMPHP's non-blocking HTTP client.

Drops in as a custom request handler so you can keep using the official SDK API while every call is non-blocking under Revolt.

Features
--------

[](#features)

- `AmpHandler` — callable handler for `OpenSearch\ClientBuilder::setHandler()`
- `HttpClientBuilder` — configured AMPHP `HttpClient` with connection pooling
- Configurable retry (limit + delay)
- Returns `Guzzle\CompletedFutureArray` (the format the SDK expects)

Installation
------------

[](#installation)

```
composer require flyokai/amp-opensearch
```

Quick start
-----------

[](#quick-start)

```
use Flyokai\AmpOpensearch\AmpHandler;
use Flyokai\AmpOpensearch\HttpClientBuilder;
use OpenSearch\ClientBuilder;

$handler = new AmpHandler(
    (new HttpClientBuilder())->build(),
    retryLimit: 3,
    retryDelay: 0.1,
);

$client = (new ClientBuilder())
    ->setHandler($handler)
    ->setHosts(['https://localhost:9200'])
    ->setBasicAuthentication('admin', 'admin')
    ->setSSLVerification(false)
    ->build();

$client->index([
    'index' => 'products',
    'id'    => 1,
    'body'  => ['name' => 'Foo', 'price' => 9.99],
]);

$result = $client->search([
    'index' => 'products',
    'body'  => ['query' => ['match' => ['name' => 'Foo']]],
]);
```

Every call inside fibers is fully non-blocking — the SDK doesn't know.

Architecture
------------

[](#architecture)

`AmpHandler::__invoke(array $request)` is invoked by the OpenSearch SDK for every operation. It:

1. Translates the SDK request array into an AMPHP `Request`
2. Executes via the configured `HttpClient`
3. Wraps the response as `CompletedFutureArray` with: `status`, `reason`, `headers`, `body` (`php://memory`), `effective_url`, `transfer_stats`, `error`
4. Retries up to `retryLimit` times with `retryDelay` between attempts on failure

`HttpClientBuilder::build()` returns an AMPHP `HttpClient` with:

- TLS without peer verification (development default)
- `UnlimitedConnectionPool`
- `DefaultConnectionFactory` + `ConnectContext`

Gotchas
-------

[](#gotchas)

- **SSL verification disabled by default.** `HttpClientBuilder` calls `withoutPeerVerification()`. Review for production.
- **Hard-coded JSON headers.** `Content-Type` and `Accept` are always `application/json`. Not customizable per request.
- **Memory stream for responses** — `php://memory`. No streaming.
- **`transfer_stats` is incomplete** — `total_time` is hardcoded to 0.
- **Requires Revolt event loop context** — retry delays use `EventLoop::delay()` + suspension. Will fail outside fibers.

See also
--------

[](#see-also)

- [`flyokai/indexer`](../indexer/README.md) — uses this for indexing operations.

License
-------

[](#license)

MIT

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance91

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Recently: every ~10 days

Total

11

Last Release

46d ago

Major Versions

0.0.1 → v1.1.22026-04-29

0.1.0 → v1.1.72026-06-08

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/247743048?v=4)[flyokai](/maintainers/flyokai)[@flyokai](https://github.com/flyokai)

---

Top Contributors

[![flyokai](https://avatars.githubusercontent.com/u/247743048?v=4)](https://github.com/flyokai "flyokai (3 commits)")[![wtsergo](https://avatars.githubusercontent.com/u/305326?v=4)](https://github.com/wtsergo "wtsergo (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/flyokai-amp-opensearch/health.svg)

```
[![Health](https://phpackages.com/badges/flyokai-amp-opensearch/health.svg)](https://phpackages.com/packages/flyokai-amp-opensearch)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[amphp/websocket-client

Async WebSocket client for PHP based on Amp.

1645.1M66](/packages/amphp-websocket-client)[putyourlightson/craft-blitz

Intelligent static page caching for creating lightning-fast sites.

155484.7k37](/packages/putyourlightson-craft-blitz)[shopware/elasticsearch

Elasticsearch for Shopware

153.9M19](/packages/shopware-elasticsearch)[davtur19/turibot

A simple way to communicate with Telegram APIs in PHP.

12215.9k](/packages/davtur19-turibot)[amphp/http-tunnel

HTTP/1.1 CONNECT tunnel connector built on the Amp concurrency framework

131.0M21](/packages/amphp-http-tunnel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
