PHPackages                             jzpeepz/eloquent-search - 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. jzpeepz/eloquent-search

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

jzpeepz/eloquent-search
=======================

Simple searching of all the Eloquent models in your project

0.6(5y ago)019MITPHPPHP ^7.3|^8.0

Since Dec 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jzpeepz/eloquent-search)[ Packagist](https://packagist.org/packages/jzpeepz/eloquent-search)[ Docs](https://github.com/jzpeepz/eloquent-search)[ RSS](/packages/jzpeepz-eloquent-search/feed)WikiDiscussions master Synced 2d ago

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

Very short description of the package
=====================================

[](#very-short-description-of-the-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/08511f7d27c9649e738bbf65829087f7f6a70eaf664bc862177256d746deb7cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a7a706565707a2f656c6f7175656e742d7365617263682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jzpeepz/eloquent-search)[![Build Status](https://camo.githubusercontent.com/11ab3bd8080f910ceec14c459b1de231bc42a7da13b355f3c45eca43926d7995/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a7a706565707a2f656c6f7175656e742d7365617263682f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/jzpeepz/eloquent-search)[![Quality Score](https://camo.githubusercontent.com/337467fa5e5f74d79ddac202208602bcd2ff51f2b57435314c0e9567ed1c702a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6a7a706565707a2f656c6f7175656e742d7365617263682e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/jzpeepz/eloquent-search)[![Total Downloads](https://camo.githubusercontent.com/ead713a87cc140011af15f5f02e03f5b63359225a067965c1d7dfadf3bc6d7b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a7a706565707a2f656c6f7175656e742d7365617263682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jzpeepz/eloquent-search)

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

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

[](#installation)

You can install the package via composer:

```
composer require jzpeepz/eloquent-search
```

Publish the config file:

```
php artisan vendor:publish --tag=eloquent-search-config
```

Publish the views so you can customize:

```
php artisan vendor:publish --tag=eloquent-search-views
```

You might need to copy this route to your routes file if you need to add middleware or customize the search uri:

```
Route::get('/search', ['as' => 'eloquent-search', 'uses' => '\Jzpeepz\EloquentSearch\Http\Controllers\SearchController@index']);
```

Include the search box in your views:

```
@include('eloquent-search::search-box')
```

Usage
-----

[](#usage)

Getting Started
===============

[](#getting-started)

To make a model searchable, it needs to use the `App\Traits\Searchable` trait.

All searchable models must also be included in the `config/eloquent-search.php` file. This allows search abstracts to be generated with the command below.

**NOTE:** An exception will be thrown if any searchable models do not have `url()` or `getSearchDescription()` methods. See the customization section for more on those methods.

Initializing Search
===================

[](#initializing-search)

Run the following command to initialize search abstracts for all searchable models.

`php artisan search:init`

Customization
=============

[](#customization)

What Gets Searched
------------------

[](#what-gets-searched)

By default, all attributes in the model will get lumped into the abstract that is searched.

To customize what gets searched, override the `getSearchAbstract()` method to return a string that should be searched.

Search Results
--------------

[](#search-results)

### Description (required)

[](#description-required)

Add a `getSearchDescription()` method to your model that returns the description you would like.

### URL (required)

[](#url-required)

Add a `url()` method to your model. This provides the URL that is linked to in search.

### Title

[](#title)

By default, Searchable will attempt to determine a good title for the result.

To customize, override the `getSearchTitle()` method on your model.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jonathan Peoples](https://github.com/jzpeepz)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~0 days

Total

6

Last Release

1972d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14534?v=4)[Jonathan Peoples](/maintainers/jzpeepz)[@jzpeepz](https://github.com/jzpeepz)

---

Top Contributors

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

---

Tags

eloquent-searchjzpeepz

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jzpeepz-eloquent-search/health.svg)

```
[![Health](https://phpackages.com/badges/jzpeepz-eloquent-search/health.svg)](https://phpackages.com/packages/jzpeepz-eloquent-search)
```

###  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)[swisnl/laravel-fulltext

Fulltext indexing and searching for Laravel

184104.5k6](/packages/swisnl-laravel-fulltext)[romanstruk/manticore-scout-engine

Laravel Manticore Scout Engine

4818.1k](/packages/romanstruk-manticore-scout-engine)[ajcastro/searchable

Pattern-matching search for Laravel eloquent models.

2847.7k](/packages/ajcastro-searchable)[statamic-rad-pack/meilisearch

meilisearch search driver for Statamic

1661.7k](/packages/statamic-rad-pack-meilisearch)

PHPackages © 2026

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