PHPackages                             mayankjaviya/lara-finder - 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. [Database &amp; ORM](/categories/database)
4. /
5. mayankjaviya/lara-finder

ActiveLibrary[Database &amp; ORM](/categories/database)

mayankjaviya/lara-finder
========================

simplify the process of searching for records in a database

1.0.0(2y ago)09PHP

Since Mar 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mayankjaviya/LaraFinder)[ Packagist](https://packagist.org/packages/mayankjaviya/lara-finder)[ RSS](/packages/mayankjaviya-lara-finder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

LaraFinder 🔍
============

[](#larafinder-)

LaraFinder is a Laravel package designed to simplify the process of searching data from the database. It provides convenient methods to search through specified columns or across all columns of a given model.

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

[](#installation)

You can install LaraFinder via Composer. Run the following command in your terminal:

```
composer require mayankjaviya/lara-finder
```

Usage
-----

[](#usage)

```
use mayankjaviya\LaraFinder\LaraFinder;

// Search for a value in specific columns
$results = LaraFinder::search('App\Models\User', 'John', ['name', 'email']);

// Search for a value across all columns
$results = LaraFinder::searchAll('App\Models\User', 'John');

// Search for a value across all columns except specified ones
$results = LaraFinder::searchAllExcept('App\Models\User', 'John', ['password']);

// It returns an associative array where each key represents a column name and the corresponding value is a collection of search results.
$results = LaraFinder::searchableColumns('App\Models\User', 'John', ['name', 'email']);

// Search for a value across multiple models
$models = ['App\Models\User', 'App\Models\Post'];
$results = LaraFinder::searchInMultipleModel($models, 'John');

// Search for a value within a related model
$results = LaraFinder::searchWithRelation('App\Models\User', 'John', 'App\Models\Post');
```

Methods
-------

[](#methods)

#### `search($model, $value, $columns)`

[](#searchmodel-value-columns)

- **Description**: Searches for a value in specified columns of the given model.
- **Parameters**:
    - `$model`: The fully qualified class name of the model to search.
    - `$value`: The value to search for.
    - `$columns`: An array of column names to search within.
- **Return Value**: A collection of search results.

#### `searchAll($model, $value)`

[](#searchallmodel-value)

- **Description**: Searches for a value across all columns of the given model.
- **Parameters**:
    - `$model`: The fully qualified class name of the model to search.
    - `$value`: The value to search for.
- **Return Value**: A collection of search results.

#### `searchAllExcept($model, $value, $except)`

[](#searchallexceptmodel-value-except)

- **Description**: Searches for a value across all columns of the given model except for the specified ones.
- **Parameters**:
    - `$model`: The fully qualified class name of the model to search.
    - `$value`: The value to search for.
    - `$except`: An array of column names to exclude from the search.
- **Return Value**: A collection of search results.

#### `searchableColumns($model, $value, $columns = [])`

[](#searchablecolumnsmodel-value-columns--)

- **Description**: Searches for a value in specified columns of the given model or in all columns if none are specified.
- **Parameters**:
    - `$model`: The fully qualified class name of the model to search.
    - `$value`: The value to search for.
    - `$columns`: (Optional) An array of column names to search within. If not provided, all columns of the model will be searched.
- **Return Value**: An associative array where each key represents a column name, and the corresponding value is a collection of search results.

#### `searchInMultipleModel($models, $value)`

[](#searchinmultiplemodelmodels-value)

- **Description**: Allows searching for a specific value across multiple models. It iterates over each model provided in the `$models` array and searches for the value in the specified columns.
- **Parameters**:
    - `$models`: An array of model class names to search within.
    - `$value`: The value to search for.
- **Return Value**: An associative array where each key represents a model class name, and the corresponding value is a query builder instance with the search conditions applied.

#### `searchWithRelation($model, $value, $relation)`

[](#searchwithrelationmodel-value-relation)

- **Description**: Enables searching for a value within a related model while also considering the main model's attributes. It utilizes eager loading to load related models and performs the search across both the main model and its related model.
- **Parameters**:
    - `$model`: The main model class name to search within.
    - `$value`: The value to search for.
    - `$relation`: The related model class name to search within.
- **Return Value**: A collection of instances of the main model (`$model`) with related models loaded where the search condition is met.

Parameters
----------

[](#parameters)

- `$model`: The fully qualified class name of the model to search.
- `$value`: The value to search for.
- `$columns`: (Optional) An array of column names to search within. If not provided, all columns of the model will be searched.
- `$except`: (Optional) An array of column names to exclude from the search.

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

[](#contributing)

Contributions are welcome! Please feel free to submit pull requests or open issues.

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](LICENSE).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

790d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4becd070b063e6afd0c54c423b356e4adab9b90e081db1575cd6439b0f71cf57?d=identicon)[mayankjaviya](/maintainers/mayankjaviya)

---

Top Contributors

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

---

Tags

eloquent-searchlaravellaravel-datatableslaravel-packagelaravel-query-builderlaravel-query-filterlaravel-search

### Embed Badge

![Health badge](/badges/mayankjaviya-lara-finder/health.svg)

```
[![Health](https://phpackages.com/badges/mayankjaviya-lara-finder/health.svg)](https://phpackages.com/packages/mayankjaviya-lara-finder)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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