PHPackages                             ctf0/easy-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. [Search &amp; Filtering](/categories/search)
4. /
5. ctf0/easy-searchable

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

ctf0/easy-searchable
====================

search model &amp; relation attributes with ease

v1.1.6(5y ago)079MITPHP

Since May 29Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ctf0/easy-searchable)[ Packagist](https://packagist.org/packages/ctf0/easy-searchable)[ Docs](https://github.com/ctf0/easy-searchable)[ Patreon](https://www.patreon.com/ctf0)[ RSS](/packages/ctf0-easy-searchable/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

 EasySearchable
 [![Latest Stable Version](https://camo.githubusercontent.com/1839e42e46ed95653f5929d29e2818366ee1ce08709fd4214e45777599d6a1dc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f637466302f656173792d73656172636861626c652e737667)](https://packagist.org/packages/ctf0/easy-searchable) [![Total Downloads](https://camo.githubusercontent.com/718d5443bf110a3a266b2481bc2d4714cf304d0942b4b69e8d327131d022caff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f637466302f656173792d73656172636861626c652e737667)](https://packagist.org/packages/ctf0/easy-searchable)
=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#----easysearchable------------)

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

[](#installation)

```
composer require ctf0/easy-searchable
```

Setup
=====

[](#setup)

> also check

- in ur model add

```
use ctf0\EasySearchable\Traits\HasSearch;

class Post extends Model
{
    use HasSearch;

    // searched attributes
    //
    // when empty, all model fields will be searched
    // except "dates, primary_key, hidden"
    public $searchableAttributes = [];

    // or have a complete freedom and directly use
    public function getSearchableAttributes()
    {
        return [
            'name->' . app()->getLocale(),
            // ...
        ];
    }

    // ignore attributes
    //
    // so instead of listing all the needed columns in `$searchableAttributes`
    // you can ignore the ones you don't need here
    public $searchableAttributesIgnore = [];

    // searched relations
    //
    // when empty, no relation will be searched
    // * under each relation add the '$searchableAttributes' and we will pick them up automatically
    // * doesn't support nested relations
    public $searchableRelations  = [];

    // we search using the full sentence,
    // however if you prefer to search by words, then use
    public $replaceSpace = true;

    // to force searching dates
    public $searchableDates = true;
}
```

Usage
=====

[](#usage)

```
// auto search in model & relations attributes
Post::search('search for something')->get();

// to strict search even further, wrap the text with either `'` or `"`
Post::search('"search for something"')->get();

// search in specific fields
Post::search('search for something', ['columnName','relation.columnName'])->get();
```

Morph Relation Search
---------------------

[](#morph-relation-search)

either use

-  **"which will disable the auto search the trait does"**
- create a scope and chain it to ur search call ex.

```
// model
public function scopeWorkerSearch($query, $searchTerm)
{
    return $query->orWhereHasMorph(
        'workerable', // name of the morph relation
        '*',
        function ($q) use ($searchTerm) {
            $q->search($searchTerm);
        }
    );
}

// controller
return $query->search($text)->workerSearch($text);
```

### Security

[](#security)

If you discover any security-related issues, please email .

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~39 days

Total

8

Last Release

1900d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/51dbfff65441e32301575f8ac241895817975e754d15574b86f543b33f1961f6?d=identicon)[ctf0](/maintainers/ctf0)

---

Top Contributors

[![ctf0](https://avatars.githubusercontent.com/u/7388088?v=4)](https://github.com/ctf0 "ctf0 (17 commits)")

---

Tags

laravelmodelphprelational-databasessearchsearchlaravelrelationctf0

### Embed Badge

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

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

###  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)[remoblaser/search

A simple to implement Search for your Application

101.5k](/packages/remoblaser-search)

PHPackages © 2026

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