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

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

soliyer/laravel-fuzzy-search
============================

A Laravel package providing a fuzzy search trait for Eloquent models to easily implement search functionality with support for concatenated attributes.

1.0.0(2y ago)1261MITPHPPHP ^7.3|^8.0

Since Mar 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/soliyer/laravel-fuzzy-search)[ Packagist](https://packagist.org/packages/soliyer/laravel-fuzzy-search)[ RSS](/packages/soliyer-laravel-fuzzy-search/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

Laravel Fuzzy Search
====================

[](#laravel-fuzzy-search)

This Laravel package provides a `FuzzySearchable` trait for Eloquent models, enabling easy implementation of search functionality with support for concatenated attributes. It's designed to enhance search experiences in Laravel applications by allowing more flexible and user-friendly search queries, including partial matches and concatenated field searches.

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

[](#installation)

To install the package via Composer, run the following command:

```
composer require soliyer/laravel-fuzzy-search
```

Make sure your Laravel version is compatible with this package by checking the Laravel version requirements in the composer.json.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

To add fuzzy search capabilities to your Eloquent models, simply use the `FuzzySearchable` trait and define the attributes you want to make searchable:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Soliyer\LaravelFuzzySearch\Traits\FuzzySearchable;

class Post extends Model
{
    use FuzzySearchable;

    protected $fillable = ['title', 'body', 'author', 'first_name', 'last_name'];

    // Specify the attributes you want to make searchable
    protected $searchable_attributes = ['title', 'body'];
}
```

You can now perform fuzzy searches on your model like so:

```
$posts = Post::fuzzySearch('Laravel')->get();
```

This will search the `title` and `body` attributes of the Post model for the term `'Laravel'`, allowing for partial matches and enhancing the search experience.

Searching Concatenated Attributes If you want to search across concatenated attributes (e.g., first and last name), define your searchable attributes as follows:

```
protected $searchable_attributes = [
    ['first_name', 'last_name'], // This will concatenate first_name and last_name with a space in between
    'email',
    'company'
];
```

### Key Points:

[](#key-points)

- **Fillable Array**: This is just an example. Replace or remove the `$fillable` property based on your actual model requirements.
- **Searchable Attributes**: Adapt the `protected $searchable_attributes` array to match the specific attributes you wish to make searchable in your models.

Then, performing a fuzzy search will include these concatenated fields in the search criteria.

Advanced Usage
--------------

[](#advanced-usage)

The FuzzySearchable trait is flexible; you can further customize search behavior by extending the trait or directly in your model methods.

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

[](#contributing)

Contributions are welcome and fully credited. Please feel free to fork the repository, make your changes, and submit a pull request on GitHub.

For major changes, please open an issue first to discuss what you would like to change. Make sure to update tests as appropriate.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the public issue tracker.

Credits
-------

[](#credits)

`Soheil Vafaei` - Package Author Special thanks to all contributors who participated in the development of this package.

License
-------

[](#license)

The Laravel Fuzzy Search package is open-sourced software licensed under the MIT license.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

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

799d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/43e650fbdc6c17d21ebb1923c94cee6a2226f0306f848d7e1da96159d0deb0b4?d=identicon)[SoheilVafaei](/maintainers/SoheilVafaei)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/soliyer-laravel-fuzzy-search/health.svg)

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

###  Alternatives

[algolia/scout-extended

Scout Extended extends Laravel Scout adding algolia-specific features

4186.3M6](/packages/algolia-scout-extended)[swisnl/laravel-fulltext

Fulltext indexing and searching for Laravel

184104.5k6](/packages/swisnl-laravel-fulltext)[kyslik/laravel-filterable

Using URL query strings to filter Eloquent queries.

11539.0k](/packages/kyslik-laravel-filterable)[devnoiseconsulting/laravel-scout-postgres-tsvector

PostgreSQL Full Text Search Driver for Laravel Scout

58110.1k](/packages/devnoiseconsulting-laravel-scout-postgres-tsvector)[vanry/laravel-scout-tntsearch

包含中文分词的 Laravel Scout TNTSearch 驱动，支持 scws, phpanalysis 和 jieba 分词。

17811.8k1](/packages/vanry-laravel-scout-tntsearch)[gtk/larasearch

A driver based solution to searching your Eloquent models supports Laravel 5.2 and Elasticsearch engine.

133.9k](/packages/gtk-larasearch)

PHPackages © 2026

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