PHPackages                             hnhdigital-os/laravel-model-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. hnhdigital-os/laravel-model-search

ActiveLibrary

hnhdigital-os/laravel-model-search
==================================

Query a model.

3.0.2(2y ago)32931MITPHPPHP ^8.0

Since Jan 9Pushed 2y agoCompare

[ Source](https://github.com/hnhdigital-os/laravel-model-search)[ Packagist](https://packagist.org/packages/hnhdigital-os/laravel-model-search)[ RSS](/packages/hnhdigital-os-laravel-model-search/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (3)Versions (32)Used By (1)

```
___  ___          _      _ _____                     _
|  \/  |         | |    | /  ___|                   | |
| .  . | ___   __| | ___| \ `--.  ___  __ _ _ __ ___| |__
| |\/| |/ _ \ / _` |/ _ \ |`--. \/ _ \/ _` | '__/ __| '_ \
| |  | | (_) | (_| |  __/ /\__/ /  __/ (_| | | | (__| | | |
\_|  |_/\___/ \__,_|\___|_\____/ \___|\__,_|_|  \___|_| |_|

```

Search a model by providing an array of attributes. Correctly builds relationships and the appropiate query. Provides inline operaters for improved user searching.

[![Latest Stable Version](https://camo.githubusercontent.com/594a1d7fffb3fabf72205325c80c8b2939f304871e4291ba4a611053b7a02245/68747470733a2f2f706f7365722e707567782e6f72672f686e686469676974616c2d6f732f6c61726176656c2d6d6f64656c2d7365617263682f762f737461626c652e737667)](https://packagist.org/packages/hnhdigital-os/laravel-model-search) [![Total Downloads](https://camo.githubusercontent.com/3ee128c855c769a4a06299e8260b9b87ec4696c38fbdc3a183c90248a527313e/68747470733a2f2f706f7365722e707567782e6f72672f686e686469676974616c2d6f732f6c61726176656c2d6d6f64656c2d7365617263682f646f776e6c6f6164732e737667)](https://packagist.org/packages/hnhdigital-os/laravel-model-search) [![Latest Unstable Version](https://camo.githubusercontent.com/6f00be71714613d2b3349c8c0e1b980659393d00c83103cbf864decd71f0ed55/68747470733a2f2f706f7365722e707567782e6f72672f686e686469676974616c2d6f732f6c61726176656c2d6d6f64656c2d7365617263682f762f756e737461626c652e737667)](https://packagist.org/packages/hnhdigital-os/laravel-model-search) [![Built for Laravel](https://camo.githubusercontent.com/ddd4a07bb769306a9338cffde2032c289e4d43d43ac346122709465a47cdff3f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c745f666f722d4c61726176656c2d677265656e2e737667)](https://laravel.com/) [![License](https://camo.githubusercontent.com/43bc93c63696ed5d5759866ca704e140829eaeb00cb735a89aa472fce4ea51ad/68747470733a2f2f706f7365722e707567782e6f72672f686e686469676974616c2d6f732f6c61726176656c2d6d6f64656c2d7365617263682f6c6963656e73652e737667)](https://packagist.org/packages/hnhdigital-os/laravel-model-search) [![Donate to this project using Patreon](https://camo.githubusercontent.com/f9e075baad95563481d35174d43ef50757281abb6bc795d0f473fad452afa030/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617472656f6e2d646f6e6174652d79656c6c6f772e737667)](https://patreon.com/RoccoHoward)

This package has been developed by H&amp;H|Digital, an Australian botique developer. Visit us at [hnh.digital](http://hnh.digital).

Documentation
-------------

[](#documentation)

- [Requirements](#requirements)
- [Installation](#install)
- [Configuration](#configuration)
- [Usage](#usage)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#requirements)

- PHP 8.0.2
- Laravel 9

Install
-------

[](#install)

Via composer:

`$ composer require hnhdigital-os/laravel-model-search ~3.0`

Configuration
-------------

[](#configuration)

Enable the trait on any given model.

```
use HnhDigital\ModelSearch\ModelTrait as ModelSearchTrait;

class SomeModel extends Model
{
    use ModelSearchTrait;
}
```

Usage
-----

[](#usage)

A simple search could be:

```
SomeModel::search(['title' => 'Test']);
SomeModel::search(['title' => [['=', 'Test']]]);
SomeModel::search(['title' => '= Test']);
SomeModel::search(['title' => '!= Test']);
```

For a better look at what is possible, check out the `tests/ModelTest.php` test case for an extensive list of possiblities.

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/hnhdigital-os/laravel-model-search/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Rocco Howard](https://github.com/RoccoHoward)
- [All Contributors](https://github.com/hnhdigital-os/laravel-model-search/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/hnhdigital-os/laravel-model-search/blob/master/LICENSE) for more information.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 96.9% 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 ~71 days

Recently: every ~64 days

Total

31

Last Release

904d ago

Major Versions

v1.x-dev → 2.0.02021-08-16

2.1.2 → 3.0.02023-05-11

PHP version history (6 changes)1.0.0PHP &gt;=7.1.0

1.1.0PHP &gt;=7.2.0

v1.x-devPHP &gt;=7.3.0

2.0.0PHP ^7.3

3.0.0PHP ^8.0.2

3.0.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5270e3a3d1add4e39f12dfde3ce549999a26f759d7128056083ab07f475259f2?d=identicon)[bluora](/maintainers/bluora)

---

Top Contributors

[![RoccoHoward](https://avatars.githubusercontent.com/u/227896?v=4)](https://github.com/RoccoHoward "RoccoHoward (94 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

laravelassetsilluminate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hnhdigital-os-laravel-model-search/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[backpack/basset

Dead-simple way to load CSS or JS assets only once per page, when using Laravel 10+.

202832.4k6](/packages/backpack-basset)[digitallyhappy/assets

Dead-simple way to load CSS or JS assets only once per page, when using Laravel 8+.

13973.4k9](/packages/digitallyhappy-assets)

PHPackages © 2026

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