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

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

james.xue/laravel-elasticsearch
===============================

A Laravel Service Provider for the Elasticsearch API client

2.3.1(3y ago)4695[1 PRs](https://github.com/xiaoxuan6/laravel-elasticsearch/pulls)MITPHPPHP &gt;=7.0CI passing

Since Nov 22Pushed 3w ago1 watchersCompare

[ Source](https://github.com/xiaoxuan6/laravel-elasticsearch)[ Packagist](https://packagist.org/packages/james.xue/laravel-elasticsearch)[ Fund](https://www.paypal.me/xuexiaoxuan)[ RSS](/packages/jamesxue-laravel-elasticsearch/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (8)Dependencies (7)Versions (22)Used By (0)

laravel-Elasticsearch
=====================

[](#laravel-elasticsearch)

[![Latest Stable Version](https://camo.githubusercontent.com/2ef712909fc1cf64929181757cb06e5fc6718da2431b5f1cec0f021345b74ed3/68747470733a2f2f706f7365722e707567782e6f72672f6a616d65732e7875652f6c61726176656c2d656c61737469637365617263682f762f737461626c652e737667)](https://packagist.org/packages/james.xue/laravel-elasticsearch)[![Total Downloads](https://camo.githubusercontent.com/8523515adf1dccbbfdd2b764225bdc9b7cc98030fcdd1abf83ff57c091656800/68747470733a2f2f706f7365722e707567782e6f72672f6a616d65732e7875652f6c61726176656c2d656c61737469637365617263682f646f776e6c6f6164732e737667)](https://packagist.org/packages/james.xue/laravel-elasticsearch)[![Latest Unstable Version](https://camo.githubusercontent.com/abce8eab6543422eac5b648f3e8d6b88501afcf426ed96228b7af43e3a46984f/68747470733a2f2f706f7365722e707567782e6f72672f6a616d65732e7875652f6c61726176656c2d656c61737469637365617263682f762f756e737461626c652e737667)](https://packagist.org/packages/james.xue/laravel-elasticsearch)[![License](https://camo.githubusercontent.com/1182ddb891dea3ee8a6fbafc81765efd3731385ef19ff114a0bee54b84c9a2f9/68747470733a2f2f706f7365722e707567782e6f72672f6a616d65732e7875652f6c61726176656c2d656c61737469637365617263682f6c6963656e73652e737667)](https://packagist.org/packages/james.xue/laravel-elasticsearch)

Install
-------

[](#install)

```
composer require "james.xue/laravel-elasticsearch"
```

Publishing configuration
------------------------

[](#publishing-configuration)

```
php artisan vendor:publish --tag=elasticsearch

```

Add env configuration
---------------------

[](#add-env-configuration)

```
ELASTICSEARCH_CONNECTION=
ELASTICSEARCH_HOST=127.0.0.1
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_INDEX=
ELASTICSEARCH_TYPE=

```

Usage
-----

[](#usage)

```
$params = SearchBuilder::setKey(1)
    ->unsetBody()
    ->builder();
$params = search()->setKey(1)->unsetBody()->builder();

ElasticsearchClient::get($params);

// or

$params = SearchBuilder::connection("elastic1")
    ->setKey(1)
    ->unsetBody()
    ->builder();
$params = search("elastic1")->setKey(1)->unsetBody()->builder();

ElasticsearchClient::connection("elastic1")->get($params);
```

更多使用方法
------

[](#更多使用方法)

[laravel-elasticsearch-demo](https://github.com/xiaoxuan6/laravel-elasticsearch-demo)

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance62

Regular maintenance activity

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.6% 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 ~36 days

Recently: every ~56 days

Total

18

Last Release

1378d ago

Major Versions

1.0.1 → 2.0.02020-11-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f8fdd2069c7594101452a5c802ae01209a31109d67a9299a67320752c30a1de?d=identicon)[xiaoxuan6](/maintainers/xiaoxuan6)

---

Top Contributors

[![xiaoxuan6](https://avatars.githubusercontent.com/u/32762220?v=4)](https://github.com/xiaoxuan6 "xiaoxuan6 (48 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (9 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

clientsearchlaravelelasticsearch

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[mailerlite/laravel-elasticsearch

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

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)[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)
