PHPackages                             pascalvgemert/laravel-simple-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. pascalvgemert/laravel-simple-search

ActiveLibrary

pascalvgemert/laravel-simple-search
===================================

Simplistic search Trait for Laravel eloquent models which can handle relevance score sorting.

0.1.0(6y ago)41281[1 issues](https://github.com/pascalvgemert/laravel-simple-search/issues)MITPHPPHP &gt;=7.0

Since Aug 30Pushed 6y agoCompare

[ Source](https://github.com/pascalvgemert/laravel-simple-search)[ Packagist](https://packagist.org/packages/pascalvgemert/laravel-simple-search)[ Docs](https://github.com/pascalvgemert/laravel-simple-search)[ RSS](/packages/pascalvgemert-laravel-simple-search/feed)WikiDiscussions master Synced 2mo ago

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

Laravel Simple Search
=====================

[](#laravel-simple-search)

Simplistic search Trait for Laravel eloquent models which can handle relevance score sorting.

### Requires Laravel 5.5 or higher!

[](#requires-laravel-55-or-higher)

About the package
-----------------

[](#about-the-package)

This trait make any table searchable without the use of an Elastic Search database or Full Text Search Tables. The query consists of some simple where like methods and the possibility to sort the query on the search relevance.

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

[](#installation)

You can install the package via composer:

```
composer require pascalvgemert/laravel-simple-search
```

Usage
-----

[](#usage)

The `SimpleSearch` trait can be used only for Eloquent Models.

```
class Post extends \Illuminate\Database\Eloquent\Model
{
    use SimpleSearch/SimpleSearch;

    /**
     * Specifiy the columns to search on, and add a weight score if needed.
     * Default weight: 1
     *
     * @var array
     */
    protected $searchable = [
        'title:3',
        'content',
    ];
}
```

### Search method

[](#search-method)

After this you can use the `search` method on an Eloquent Model instance, like so:

```
// Find's posts with the phrases `cats` and/or `funny`.
$results = Post::search('funny cats')->sortByDesc('score')->take(10)->get();

```

You can also specify if the search result must match *all* the keywords or *any* of the keywords.

```
// Find's posts which both include the phrases `cats` and `funny`.
$results = Post::search('funny cats', true)->sortByDesc('score')->take(10)->get();

```

If you don't want to use the relevance score to sort, you can specify to remove the score column from the result.

```
// Find's the last 10 posts with the phrases `cats` and/or `funny`.
$results = Post::search('funny cats', false, true)->sortByDesc('created_at')->take(10)->get();

```

Author
------

[](#author)

- [Pascal van Gemert](https://github.com/pascalvgemert)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

2444d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/609e8d7caaa1dacc8b03bcc8347b5732e5a91399bb843e5b44fec66be256f35a?d=identicon)[pascalvgemert](/maintainers/pascalvgemert)

---

Top Contributors

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

---

Tags

searchablepascalvgemertlaravel-simple-searchsimple searchrelevance scorelike query

### Embed Badge

![Health badge](/badges/pascalvgemert-laravel-simple-search/health.svg)

```
[![Health](https://phpackages.com/badges/pascalvgemert-laravel-simple-search/health.svg)](https://phpackages.com/packages/pascalvgemert-laravel-simple-search)
```

###  Alternatives

[nicolaslopezj/searchable

Eloquent model search trait.

2.0k2.7M35](/packages/nicolaslopezj-searchable)[sofa/eloquence-base

Flexible Searchable, Mappable, Metable, Validation and more extensions for Laravel Eloquent ORM.

792.0M27](/packages/sofa-eloquence-base)[jedrzej/searchable

Searchable trait for Laravel's Eloquent models - filter your models using request parameters

127259.1k4](/packages/jedrzej-searchable)[maize-tech/laravel-searchable

Laravel Searchable

11249.5k](/packages/maize-tech-laravel-searchable)[h-farm/laravel-searchable

Laravel Searchable

1121.6k](/packages/h-farm-laravel-searchable)

PHPackages © 2026

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