PHPackages                             iboxs/elasticsearch - 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. iboxs/elasticsearch

ActiveLibrary

iboxs/elasticsearch
===================

ElasticSearch 类似ORM访问开发包

1.0.0(3y ago)07MITPHPPHP &gt;=7.2

Since Jul 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/itlattice/elasticsearch)[ Packagist](https://packagist.org/packages/iboxs/elasticsearch)[ RSS](/packages/iboxs-elasticsearch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

PHP ELASTICSEARCH ORM
=====================

[](#php-elasticsearch-orm)

安装/Install
----------

[](#安装install)

```
composer require iboxs/elasticsearch

```

支持ElasticSearch版本
-----------------

[](#支持elasticsearch版本)

> more than 7.0

使用方法
----

[](#使用方法)

### PHP原生

[](#php原生)

```
    //require elasticsearch config
    $config = require "elasticsearch.php";
    //instance
    $builder = Factory::builder($config);
```

### 基于Laravel框架

[](#基于laravel框架)

请将以下配置写入 `config/app.php`

```
    'providers' => [
        Iboxs\ElasticSearch\Laravel\ElasticsearchOrm\OrmProvider::class,
    ]
```

使用以下代码初始化

```
    $builder = app(\Iboxs\ElasticSearch\Builder::class);
```

### 其他框架

[](#其他框架)

- 作者因没时间再维护，目前就只支持laravel框架使用，若需其他框架，可根据laravel框架写法自行改写，若有疑问，可联系作者QQ320587491

快速开始
----

[](#快速开始)

### Create

[](#create)

```
    $builder->index('index')->create(['key' => 'value']);
    //return collection
    $builder->index('index')->createCollection(['key' => 'value']);
```

### Update

[](#update)

```
    $builder->index('index')->update(['key' => 'value']) : bool
```

### Delete

[](#delete)

```
    $builder->index('index')->delete($id) : bool
```

### Select

[](#select)

```
    //select one
    $builder->index('index')->first();
    //select all
    $builder->index('index')->get();
    //select with paginate
    $builder->index('index')->paginate($page, $size) : Collection
    //select by id
    $builder->byId($id) : stdClass
    //select by id if failed throw error
    $builder->byIdOrFail($id) : stdClass
    //select chunk
    $builder->chunk(callback $callback, $limit = 2000, $scroll = '10m')
```

### Count

[](#count)

```
    $builder->count() : int
```

### Condition

[](#condition)

whereTerm

```
    $builder->whereTerm('key', 'value');
```

whereLike（wildcard）

```
    //value without add wildcard '*'
    $builder->whereLike('key', 'value');
```

match

```
    $builder->whereMatch('key', 'value');
```

range

```
    $builder->whereBetween('key', ['value1', 'value2']);
```

where in

```
    $builder->whereIn('key', ['value1', 'value2', ...]);
```

nested

```
    $builder->where(function(Builder $query){
        $query->whereTerm('key', 'value');
    });
```

### 查询布尔运算标识

[](#查询布尔运算标识)

> \['=' =&gt; 'eq','&gt;' =&gt; 'gt','&gt;=' =&gt; 'gte','&lt;' =&gt; 'lt','&lt;=' =&gt; 'lte','!=' =&gt; 'ne',\]

```
    $builder->where('key', '=', 'value');
```

### 更多

[](#更多)

请自行查阅源代码（Client文件为入口文件）

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1405d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/89eac34578919508993255948f343a12dd87fbf7f49fe17d147a6715f20da1bd?d=identicon)[itlattice](/maintainers/itlattice)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/iboxs-elasticsearch/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[stancl/tenancy

Automatic multi-tenancy for your Laravel application.

4.3k6.6M40](/packages/stancl-tenancy)[laravel/vapor-cli

The Laravel Vapor CLI

31310.7M8](/packages/laravel-vapor-cli)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5682.0M15](/packages/directorytree-ldaprecord-laravel)[sassnowski/venture

A package to manage complex workflows built on top of Laravel's queue.

825254.5k1](/packages/sassnowski-venture)

PHPackages © 2026

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