PHPackages                             nuwber/oponka - 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. nuwber/oponka

ActiveLibrary[API Development](/categories/api)

nuwber/oponka
=============

To be described

v0.1.3(8mo ago)21.4k↓82.2%MITPHPPHP ^8.2CI passing

Since Jul 23Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/nuwber/oponka)[ Packagist](https://packagist.org/packages/nuwber/oponka)[ Docs](https://github.com/nuwber/oponka)[ RSS](/packages/nuwber-oponka/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (10)Versions (9)Used By (0)

Oponka: Laravel OpenSearch Integration
======================================

[](#oponka-laravel-opensearch-integration)

> This package was inspired by the [Plastic](https://github.com/sleimanx2/plastic) package, which provided a similar integration for Elasticsearch. Oponka builds upon the concepts established by Plastic, adapting them for the OpenSearch ecosystem. However, unlike Plastic, Oponka focuses solely on OpenSearch and does not include functionality for mapping indices to Eloquent models.

Oponka provides a seamless integration with OpenSearch for Laravel applications (version 10 and above). It simplifies the process of interacting with OpenSearch, allowing you to easily perform searches, index documents, and manage your OpenSearch data.

Features
--------

[](#features)

**Native OpenSearch Library**: Utilizes the official OpenSearch PHP client for direct and efficient communication with your OpenSearch cluster.
**OpenSearch DSL**: Leverages the opensearch-dsl library to provide a more intuitive and expressive syntax for building complex search queries.
**Easy Configuration**: Simple configuration options allow you to quickly connect to your OpenSearch cluster and customize the package's behavior.
**Laravel Integration**: Integrates seamlessly with Laravel's service container and provides convenient helpers for accessing OpenSearch functionality within your application.

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

[](#installation)

Install the package using Composer:

```
php composer require nuwber/oponka
```

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

[](#configuration)

The OponkaServiceProvider will be used automatically as it is configured in the composer.json file.

If you need it in your project, you can use the following commands:

```
php artisan vendor:publish --provider="Nuwber\Oponka\OponkaServiceProvider"
```

### Configure the Oponka connection:

[](#configure-the-oponka-connection)

Open the config/oponka.php file and change the connection settings as needed. Or do it with `.env` file.

Usage
-----

[](#usage)

The primary way to interact with Oponka is through the `Oponka` facade.

### Getting the Client

[](#getting-the-client)

You can access the underlying OpenSearch PHP client instance directly if needed:

```
use Nuwber\Oponka\Facades\Oponka;

$client = Oponka::client();
// Now you can use the $client directly with the OpenSearch PHP client methods
```

### Indexing Documents

[](#indexing-documents)

To index a document, you can use the `index` method:

```
use Nuwber\Oponka\Facades\Oponka;

$params = [
    'index' => 'my_index',
    'id'    => 'my_id',
    'body'  => ['testField' => 'abc']
];

$response = Oponka::index($params);

// $response contains the OpenSearch response array
```

### Searching Documents

[](#searching-documents)

Oponka integrates with `opensearch-dsl/opensearch-dsl`. You can build your queries using its syntax.

```
use Nuwber\Oponka\Facades\Oponka;
use OpenSearchDSL\Search;
use OpenSearchDSL\Query\Compound\BoolQuery;
use OpenSearchDSL\Query\TermLevel\TermQuery;
use OpenSearchDSL\Query\FullText\MatchQuery;

// Get the DSL Search object
$search = Oponka::search(); // Or potentially a method to get a new Search object

// Build a query
$query = new BoolQuery();
$query->add(new MatchQuery('title', 'laravel'));
$query->add(new TermQuery('status', 'published'), BoolQuery::FILTER);

$search->addQuery($query);
$search->setSource(['title', 'status', 'publish_date']);
$search->setSize(10);
$search->setFrom(0); // for pagination

// Prepare the parameters for OpenSearch
$params = [
    'index' => 'my_index',
    'body' => $search->toArray(),
];

// Execute the search
$results = Oponka::search($params);

// Process results (assuming a Result object or similar is returned)
// foreach ($results->getHits() as $hit) {
//     // Access hit data: $hit['_source'], $hit['_score'], etc.
// }
// $total = $results->getTotal();
```

*Note: The exact methods for accessing the DSL builder and processing results might differ slightly. Please refer to the source code or tests for precise implementation.*

### Updating Documents

[](#updating-documents)

Use the `update` method:

```
use Nuwber\Oponka\Facades\Oponka;

$params = [
    'index' => 'my_index',
    'id'    => 'my_id',
    'body'  => [
        'doc' => [
            'new_field' => 'xyz'
        ]
    ]
];

$response = Oponka::update($params);
```

### Deleting Documents

[](#deleting-documents)

Use the `delete` method:

```
use Nuwber\Oponka\Facades\Oponka;

$params = [
    'index' => 'my_index',
    'id'    => 'my_id'
];

$response = Oponka::delete($params);
```

### Direct Client Access

[](#direct-client-access)

For operations not directly exposed or for more complex scenarios, you can always fall back to the native OpenSearch client:

```
use Nuwber\Oponka\Facades\Oponka;

$client = Oponka::client();

$response = $client->cat()->indices(['index' => 'my_index', 'v' => true]);
```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance60

Regular maintenance activity

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~149 days

Total

4

Last Release

251d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/464043?v=4)[Eugene Kirdzei](/maintainers/masterjus)[@masterjus](https://github.com/masterjus)

---

Top Contributors

[![eugene-nuwber](https://avatars.githubusercontent.com/u/142213350?v=4)](https://github.com/eugene-nuwber "eugene-nuwber (6 commits)")[![andrew-nuwber](https://avatars.githubusercontent.com/u/33055211?v=4)](https://github.com/andrew-nuwber "andrew-nuwber (2 commits)")

---

Tags

laravelopensearchlaravelopensearchoponka

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/nuwber-oponka/health.svg)

```
[![Health](https://phpackages.com/badges/nuwber-oponka/health.svg)](https://phpackages.com/packages/nuwber-oponka)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

9782.1M161](/packages/laravel-ai)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.6k](/packages/larastan-larastan)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76518.2M119](/packages/laravel-mcp)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

721160.4k12](/packages/tallstackui-tallstackui)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8385.5M96](/packages/laravel-doctrine-orm)

PHPackages © 2026

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