PHPackages                             hovjacky/nosql - 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. [Search &amp; Filtering](/categories/search)
4. /
5. hovjacky/nosql

ActiveLibrary[Search &amp; Filtering](/categories/search)

hovjacky/nosql
==============

PHP Client for Elasticsearch (MongoDB and Cassandra are almost finished) - easy and unified queries

v3.1.0(1y ago)018.1k↓66.7%1[1 PRs](https://github.com/hovjacky/nosql/pulls)MITPHPPHP &gt;=8.2 &lt;8.4

Since Feb 14Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/hovjacky/nosql)[ Packagist](https://packagist.org/packages/hovjacky/nosql)[ Docs](https://github.com/hovjacky/nosql)[ RSS](/packages/hovjacky-nosql/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (14)Used By (0)

NoSQL - PHP Clients
===================

[](#nosql---php-clients)

This package creates unified API for some NoSQL databases (at the time only Elasticsearch, MongoDB and Cassandra need to be finished).

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

[](#installation)

The recommended way is via Composer:

```
composer require hovjacky/nosql

```

It requires PHP version 7.0 and higher.

Usage
-----

[](#usage)

Connection parameters (host, port, index) have to be passed as an array to the constructor of `ElasticsearchClient`.

The following methods are supported:

- insert - array `$data`
- bulkInsert - array `$data`
- get - int `$id`
- update - int `$id`, array `$data`
- delete - int `$id`
- deleteAll
- findBy - array `$params` - details described below.

All have `table` as first parameter (in Elasticsearch it is the type name).

\####Method findBy Method findBy can be used for search. It supports quite a wide range of parameters (you can find comparison with SQL in parentheses):

- fields - array of fields user wants to retrieve (`SELECT id, name FROM`)
- limit - max. number of results (`LIMIT 10`)
- offset - can only be used with limit (`LIMIT 10, 10`)
- count - only get number of results
- orderBy - array of fields to order by, e.g. `['id', 'name']`, descendant order is marked by lowercase desc - `['id desc', 'name']` (`ORDER BY id DESC, name`)
- groupBy - array of fields to group by, e.g. `['id', 'name']` (`GROUP BY id, name`)
    - Elasticsearch only:
        - groupByScript - instead of a field name, `groupBy` can contain the word `script`and `groupByScript` can then contain an elasticsearch script ()
        - groupInternalOrderBy - array of fields to group by content inside each bucket (no SQL equivalent)
- aggregation - an associative array, keys are aggregation functions like max, min, avg, etc. and values are names of fields the aggregations should apply to, e.g. `['min' => ['id', 'age'], 'avg' => ['age']]` (`SELECT MIN(id), MIN(age), AVG(age) FROM`)
- where - an associative array, keys are conditions with placeholders (?) and values are values. Conditions accept operators =, !=, &gt;, &lt;, &gt;=, &lt;=, LIKE, IS NULL, IS NOT NULL, CROSS FIELDS.
    - LIKE - the value should contain % (the same as in SQL)
    - = - the value can be an array, e.g. `['id = ?' => [1, 3, 7]]` (`id IN (1, 3, 7)`)
    - IS NULL, IS NOT NULL - Elasticsearch only
    - CROSS FIELDS - searching string in multiple fields, e.g. name `John Smith` in fields `firstname` and `surname`. Syntax is `"firstname,surname CROSS FIELDS ?" => "John Smith"`

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance54

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% 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 ~270 days

Recently: every ~62 days

Total

10

Last Release

581d ago

Major Versions

1.0.1 → v2.0.02021-09-24

v2.0.1 → v3.0.02023-12-19

PHP version history (5 changes)1.0PHP ^7.0

v2.0.0PHP &gt;=7.3 &lt;=8.1

v2.0.1PHP &gt;=7.3 &lt;8.3

v3.0.0PHP &gt;=8.2 &lt;8.3

v3.0.4PHP &gt;=8.2 &lt;8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c1162aeb5cded5e6ba23bb8eef18fe5d2bb92aa033a9dfec382a2775b973659?d=identicon)[hovjacky](/maintainers/hovjacky)

---

Top Contributors

[![hovjacky](https://avatars.githubusercontent.com/u/34470205?v=4)](https://github.com/hovjacky "hovjacky (25 commits)")

---

Tags

elasticsearchnosql

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hovjacky-nosql/health.svg)

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

###  Alternatives

[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[matchish/laravel-scout-elasticsearch

Search among multiple models with ElasticSearch and Laravel Scout

7431.6M2](/packages/matchish-laravel-scout-elasticsearch)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)[jsq/amazon-es-php

Support for using IAM authentication with the official Elasticsearch PHP client

9310.6M13](/packages/jsq-amazon-es-php)[babenkoivan/elastic-client

The official PHP Elasticsearch client integrated with Laravel

544.0M6](/packages/babenkoivan-elastic-client)

PHPackages © 2026

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