PHPackages                             traore225/laravel-smart-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. [Database &amp; ORM](/categories/database)
4. /
5. traore225/laravel-smart-search

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

traore225/laravel-smart-search
==============================

A lightweight, configurable, scoring-based search engine for Laravel with FULLTEXT support and automatic fallback.

v1.0.1(3mo ago)00MITPHPPHP ^8.1

Since Feb 18Pushed 3mo agoCompare

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

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

Laravel Smart Search
====================

[](#laravel-smart-search)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9e6490869af432f534344c2e426904423666219e0c8dfa8daa15e4e895d82c52/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7472616f72653232352f6c61726176656c2d736d6172742d7365617263682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/traore225/laravel-smart-search)[![Total Downloads](https://camo.githubusercontent.com/bbd67d7c7326ce8cd360d255863c590d85d49ff8b1b00a9e523492af33a29234/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7472616f72653232352f6c61726176656c2d736d6172742d7365617263682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/traore225/laravel-smart-search)[![License](https://camo.githubusercontent.com/1fa8799da8a5646abd40fb7070bca446eb7cfc5430d71c65728995ccbb112d4e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7472616f72653232352f6c61726176656c2d736d6172742d7365617263682e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A lightweight, configurable, scoring-based search engine for Laravel.

Laravel Smart Search provides:

- Exact match priority
- Weighted scoring system
- FULLTEXT support (MySQL/MariaDB)
- Automatic fallback to LIKE search
- Configurable columns
- Safe FULLTEXT detection (no crashes)
- Optional fallback disabling per request

---

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

[](#installation)

Install via Composer:

```
composer require traore225/laravel-smart-search
```

---

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

[](#requirements)

- PHP 8.1+
- Laravel 10+ / 11+
- MySQL or MariaDB recommended for FULLTEXT support

---

Publish Configuration
---------------------

[](#publish-configuration)

```
php artisan vendor:publish --tag=smart-search-config
```

This creates:

`config/smart-search.php`

---

FULLTEXT Setup (Recommended)
----------------------------

[](#fulltext-setup-recommended)

Generate a migration for your FULLTEXT index:

```
php artisan smart-search:make-index --table=posts --columns=title
php artisan migrate
```

Check if FULLTEXT is installed:

```
php artisan smart-search:install --table=posts --column=title
```

If you prefer to add it manually:

```
ALTER TABLE posts ADD FULLTEXT (title);
```

> FULLTEXT is optional but recommended for performance. Smart Search automatically detects if FULLTEXT is available and safely disables it if missing.

---

Basic Usage
-----------

[](#basic-usage)

```
use Traore225\LaravelSmartSearch\Search\SearchEngine;

$engine = app(SearchEngine::class);

$query = \App\Models\Post::query();

$query = $engine->apply($query, [
    'description' => 'ps3 controller',
]);

$results = $query->paginate();
```

---

Disable Fallback (Per Request)
------------------------------

[](#disable-fallback-per-request)

```
$query = $engine->apply($query, [
    'description' => 'ps3 controller',
    'fallback' => false,
]);
```

---

Configuration Example
---------------------

[](#configuration-example)

```
return [
    'max_title_tokens' => 3,

    'columns' => [
        'title' => 'title',
        'description' => 'description',
    ],

    'fulltext' => [
        'enabled' => true,
        'multiplier' => 10,
    ],

    'weights' => [
        'exact_title' => 1000000,
        'title_word_base' => 4000,
        'title_word_step' => 500,
        'title_cumulative_base' => 3000,
        'title_cumulative_step' => 300,
    ],

    'fallback' => [
        'enabled' => true,
        'min_words' => 2,
        'fields' => ['title', 'description'],
    ],
];
```

---

How It Works
------------

[](#how-it-works)

Priority order:

1. Exact match
2. Weighted LIKE scoring
3. FULLTEXT boolean scoring (if available)
4. Fallback LIKE search (if enabled)

FULLTEXT is auto-detected and safely disabled when the index is missing.

---

Database Support
----------------

[](#database-support)

DatabaseSupportMySQLFullMariaDBFullPostgreSQLLIKE fallback onlySQLiteLIKE fallback only---

Performance
-----------

[](#performance)

- FULLTEXT auto-detected and cached
- No crash if index is missing
- Minimal overhead
- No external dependencies

---

License
-------

[](#license)

MIT License © 2026 Traore Sidiki

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

90d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

searchlaravelmysqleloquentfulltextfallbacksmart search

### Embed Badge

![Health badge](/badges/traore225-laravel-smart-search/health.svg)

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

###  Alternatives

[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k25.2M34](/packages/kirschbaum-development-eloquent-power-joins)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

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