PHPackages                             friendsofcat/opensearch-client - 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. [API Development](/categories/api)
4. /
5. friendsofcat/opensearch-client

ActiveLibrary[API Development](/categories/api)

friendsofcat/opensearch-client
==============================

The official PHP OpenSearch client integrated with Laravel

2.0.0(3y ago)7457.6k↓18.6%11MITPHPPHP ^7.4 || ^8.0

Since Oct 17Pushed 3y agoCompare

[ Source](https://github.com/friendsofcat/opensearch-client)[ Packagist](https://packagist.org/packages/friendsofcat/opensearch-client)[ Fund](https://paypal.me/babenkoi)[ Fund](https://ko-fi.com/ivanbabenko)[ RSS](/packages/friendsofcat-opensearch-client/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (1)

OpenSearch Client
=================

[](#opensearch-client)

The official PHP OpenSearch client integrated with Laravel.

Contents
--------

[](#contents)

- [Compatibility](#compatibility)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)

Compatibility
-------------

[](#compatibility)

The current version of OpenSearch Client has been tested with the following configuration:

- PHP 7.4-8.x
- Opensearch 2.x

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

[](#installation)

The library can be installed via Composer:

```
composer require friendsofcat/opensearch-client
```

Configuration
-------------

[](#configuration)

To change the client settings you need to publish the configuration file first:

```
php artisan vendor:publish --provider="OpenSearch\Laravel\Client\ServiceProvider"
```

In the newly created `config/opensearch.client.php` file you can define the default connection name.

```
return [
    'default' => env('OPENSEARCH_CONNECTION', 'default'),
    'connections' => [
        'default' => [
            'hosts' => [
                env('OPENSEARCH_HOST', 'localhost:9200'),
            ],
            // you can also set HTTP client options (which is Guzzle by default) as follows
            'httpClientOptions' => [
                'timeout' => 2,
            ],
        ],
    ],
];
```

If you need more control over the client creation, you can create your own client builder:

```
// see OpenSearch\Laravel\Client\ClientBuilder for the reference
class MyClientBuilder implements OpenSearch\Laravel\Client\ClientBuilderInterface
{
    public function default(): Client
    {
        // should return a client instance for the default connection
    }

    public function connection(string $name): Client
    {
        // should return a client instance for the connection with the given name
    }
}
```

Do not forget to register the builder in your application service provider:

```
class MyAppServiceProvider extends Illuminate\Support\ServiceProvider
{
    public function register()
    {
        $this->app->singleton(ClientBuilderInterface::class, MyClientBuilder::class);
    }
}
```

Usage
-----

[](#usage)

Use `OpenSearch\Laravel\Client\ClientBuilderInterface` to get access to the client instance:

```
namespace App\Console\Commands;

use OpenSearch\Client;
use OpenSearch\Laravel\Client\ClientBuilderInterface;
use Illuminate\Console\Command;

class CreateIndex extends Command
{
    protected $signature = 'create:index {name}';

    protected $description = 'Creates an index';

    public function handle(ClientBuilderInterface $clientBuilder)
    {
        // get a client for the default connection
        $client = $clientBuilder->default();
        // get a client for the connection with name "write"
        $client = $clientBuilder->connection('write');

        $client->indices()->create([
            'index' => $this->argument('name')
        ]);
    }
}
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.5% 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 ~189 days

Total

2

Last Release

1165d ago

Major Versions

0.1.0 → 2.0.02023-04-25

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16599401?v=4)[Erik Araujo](/maintainers/erikaraujo)[@erikaraujo](https://github.com/erikaraujo)

---

Top Contributors

[![babenkoivan](https://avatars.githubusercontent.com/u/25812954?v=4)](https://github.com/babenkoivan "babenkoivan (47 commits)")[![erikaraujo](https://avatars.githubusercontent.com/u/16599401?v=4)](https://github.com/erikaraujo "erikaraujo (8 commits)")

---

Tags

phpclientlaravelopensearch

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/friendsofcat-opensearch-client/health.svg)

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

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M89](/packages/openai-php-laravel)[google-gemini-php/laravel

Google Gemini PHP for Laravel is a supercharged PHP API client that allows you to interact with the Google Gemini AI API

639574.3k8](/packages/google-gemini-php-laravel)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

74331.3k1](/packages/mozex-anthropic-laravel)[gemini-api-php/laravel

Gemini API client for Laravel

8917.4k](/packages/gemini-api-php-laravel)

PHPackages © 2026

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