PHPackages                             beaumind/searchable - 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. beaumind/searchable

ActiveLibrary

beaumind/searchable
===================

a simple php trait for laravel to search in models and related models

1.0.1(9y ago)3201MITPHPPHP &gt;=5.4

Since Jan 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/beaumind/searchable)[ Packagist](https://packagist.org/packages/beaumind/searchable)[ RSS](/packages/beaumind-searchable/feed)WikiDiscussions master Synced 2mo ago

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

searchable
==========

[](#searchable)

a simple php trait for laravel &gt;= 5.0 to search in models and related models

Installation
============

[](#installation)

Simply Run the Composer require comand.

```
composer require beaumind/searchable

```

Usage
=====

[](#usage)

Add the trait to your model and your search rules.

```
use Beaumind\Searchable\Searchable;

class Post extends \Eloquent
{
    use Searchable;

    /**
     * Searchable columns.
     *
     * @var array
     */
    public $searchable_fields = [
      title,
      body,
      user.name,
      uesr.email
    ];

    public function user()
    {
        return $this->belongsTo('User');
    }

}
```

Now you can search your model.

```
// Simple search
$posts = Post::search($query)->get();

// Search and get relations
// It will not get the relations if you don't do this
$posts = Post::search($query)
            ->with('user')
            ->get();
```

Search Paginated
----------------

[](#search-paginated)

As easy as laravel default queries

```
// Search with relations and paginate
$posts = Post::search($query)
            ->with('user')
            ->paginate(20);
```

Mix queries
-----------

[](#mix-queries)

Search method is compatible with any eloquent method. You can do things like this:

```
// Search only active posts
$posts = Post::where('status', 'active')
            ->search($query)
            ->paginate(20);
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

2

Last Release

3418d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24860137?v=4)[Amir Hassani](/maintainers/beaumind)[@beaumind](https://github.com/beaumind)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/beaumind-searchable/health.svg)

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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