PHPackages                             naph/searchlight - 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. naph/searchlight

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

naph/searchlight
================

Search query language for Laravel 5.4+ supporting Eloquent and Elasticsearch

0.6.0(8y ago)22.3k1MITPHPPHP ^7.0

Since May 25Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Naph/searchlight)[ Packagist](https://packagist.org/packages/naph/searchlight)[ RSS](/packages/naph-searchlight/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (7)Versions (16)Used By (0)

Searchlight
-----------

[](#searchlight)

An *Elasticsearch* search query language for **Laravel** featuring multi-model search

```
public function search(Search $search, Comment $comments, Post $posts)
{
    return $search->in($comments, $posts)
        ->match('Searchlight')
        ->get();
}
```

and built-in qualifier reducers.

```
$driver->qualifier('/#(\w+)/', function (Search $search, $fragment) {
    $search->filter(['tags' => $fragment]);
});
```

Install
-------

[](#install)

Using composer

```
composer require naph/searchlight
```

Register the service provider

```
Naph\Searchlight\SearchlightServiceProvider;
```

Publish vendor files containing driver and host configuration. Lumen users should copy the file instead.

```
php artisan vendor:publish --tag searchlight
```

Setup models by implementing the contract/trait pair and overriding `getSearchableFields`. The trait binds events to saved and deleted so indices are kept in sync with your database.

```
use Illuminate\Database\Eloquent\Model;
use Naph\Searchlight\Model\SearchlightContract;
use Naph\Searchlight\Model\SearchlightTrait;

class Topic extends Model implements SearchlightContract
{
    use SearchlightTrait;

    public function getSearchableFields(): array
    {
        return [
            'title' => 1,
            'description' => 0.5,
            'content' => 0.1
        ];
    }
}
```

Storing this model's fully qualified classname in `searchlight.repositories` config ensures their indices are built when running:

```
php artisan searchlight:rebuild
```

This command destroys all existing indexed documents in the process.

Requirements
------------

[](#requirements)

Currently only supports PHP7 and latest versions of Laravel and Lumen.

License
-------

[](#license)

Searchlight is an open-sourced software licensed under the [MIT license](https://raw.githubusercontent.com/Naph/searchlight/master/LICENSE).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.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 ~7 days

Total

14

Last Release

3233d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5093291?v=4)[Lachlan du Preez](/maintainers/Naph)[@Naph](https://github.com/Naph)

---

Top Contributors

[![Naph](https://avatars.githubusercontent.com/u/5093291?v=4)](https://github.com/Naph "Naph (25 commits)")[![joelshepherd](https://avatars.githubusercontent.com/u/4484306?v=4)](https://github.com/joelshepherd "joelshepherd (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/naph-searchlight/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M125](/packages/laravel-pulse)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k53.0M597](/packages/laravel-scout)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M123](/packages/roots-acorn)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[flat3/lodata

OData v4.01 Producer for Laravel

99351.7k](/packages/flat3-lodata)

PHPackages © 2026

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