PHPackages                             saber13812002/laravel-fulltext - 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. saber13812002/laravel-fulltext

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

saber13812002/laravel-fulltext
==============================

Fulltext indexing and searching for Laravel

v2.3(2y ago)1476↓100%MITPHPPHP ^7.4|^8.0

Since Jun 19Pushed 2y agoCompare

[ Source](https://github.com/saber13812002/laravel-fulltext)[ Packagist](https://packagist.org/packages/saber13812002/laravel-fulltext)[ Docs](https://github.com/saber13812002/laravel-fulltext)[ RSS](/packages/saber13812002-laravel-fulltext/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (6)Used By (0)

Laravel fulltext index and search
=================================

[](#laravel-fulltext-index-and-search)

[![Latest Version on Packagist](https://camo.githubusercontent.com/631eee7acd566a03440aa0d460970b128674eb8edd483f86e001978ae3f41b0e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737769736e6c2f6c61726176656c2d66756c6c746578742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swisnl/laravel-fulltext)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Buy us a tree](https://camo.githubusercontent.com/cec0a9b35a1c3235bdbe0d13ea8fbd866a23e30280ad6ca27078c1fd4ac1b709/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://plant.treeware.earth/swisnl/laravel-fulltext)[![Build Status](https://camo.githubusercontent.com/fdbd4ace3e815eedc7ddb081c7497a3205681b1b69e3e46b0fce636a276aecbe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769736e6c2f6c61726176656c2d66756c6c746578742f74657374732e796d6c3f6c6162656c3d7465737473266272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/swisnl/laravel-fulltext/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/2512b9c20e91f57dd90550cf096d11e69e522670e9007fef75fc4909706215d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737769736e6c2f6c61726176656c2d66756c6c746578742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swisnl/laravel-fulltext)[![Made by SWIS](https://camo.githubusercontent.com/ef6bdd6ab8d4f47bceb74dcf558b0915c6b419cbba320096324af0518e43091d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539412538302d6d6164652532306279253230535749532d2532333037333741392e7376673f7374796c653d666c61742d737175617265)](https://www.swis.nl)

This package creates a MySQL fulltext index for models and enables you to search through those.

Install
-------

[](#install)

1. Install with composer `composer require swisnl/laravel-fulltext`
2. Publish migrations and config `php artisan vendor:publish --tag=laravel-fulltext`
3. Migrate the database `php artisan migrate`

Usage
-----

[](#usage)

The package uses a model observer to update the index when models change. If you want to run a full index you can use the console commands.

### Models

[](#models)

Add the `Indexable` trait to the model you want to have indexed and define the columns you'd like to index as title and content.

#### Example

[](#example)

```
class Country extends Model
{

    use \Saber13812002\Laravel\Fulltext\Indexable;

    protected $indexContentColumns = ['biographies.name', 'political_situation', 'elections'];
    protected $indexTitleColumns = ['name', 'governmental_type'];

}
```

You can use a dot notation to query relationships for the model, like `biographies.name`.

### Searching

[](#searching)

You can search using the Search class.

```
$search = new \Saber13812002\Laravel\Fulltext\Search();
$search->run('europe');
```

This will return a Collection of `\Saber13812002\Laravel\Fulltext\IndexedRecord` which contain the models in the Polymorphic relation `indexable`.

If you only want to search a certain model you can use `$search->runForClass('europe', Country::class);`. This will only return results from that model.

### Artisan Commands

[](#artisan-commands)

#### laravel-fulltext:all

[](#laravel-fulltextall)

Index all models for a certain class.

```
php artisan laravel-fulltext:all \\App\\Models\\Country
```

#### laravel-fulltext:one

[](#laravel-fulltextone)

Index a single model of a certain class.

```
php artisan laravel-fulltext:one \\App\\Models\\Country 4
```

Options
-------

[](#options)

### db\_connection

[](#db_connection)

Choose the database connection to use, defaults to the default database connection. When you are NOT using the default database connection, this MUST be set before running the migration to work correctly.

### weight.title weight.content

[](#weighttitle-weightcontent)

Results on `title` or `content` are weighted in the results. Search result score is multiplied by the weight in this config.

### enable\_wildcards

[](#enable_wildcards)

Enable wildcard after words. So when searching for example `car` it will also match `carbon`.

### exclude\_feature\_enabled

[](#exclude_feature_enabled)

This feature excludes some rows from being returned. Enable this when you have a flag in your model which determines whether this record must be returned in search queries or not. By default this feature is disabled.

### exclude\_records\_column\_name

[](#exclude_records_column_name)

The column name for that property (which acts as a flag). This must match the exact column name at the table.

#### An example of using this feature

[](#an-example-of-using-this-feature)

If you have a blog and then added this search functionality to your blog to search through your blog posts. Sometimes you do not want some posts to appear in the search result, for example when a post is not published yet. This feature helps you to do it.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Björn Brala](https://github.com/swisnl)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/swisnl/laravel-fulltext) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

SWIS ❤️ Open Source
-------------------

[](#swis-heart-open-source)

[SWIS](https://www.swis.nl) is a web agency from Leiden, the Netherlands. We love working with open source software.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.1% 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 ~3 days

Total

4

Last Release

1049d ago

Major Versions

v1.0 → v2.02023-06-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/e7e5641b8ce7d13a4d02cfd10151438c72b0543b172af62384b81cfd986a15b5?d=identicon)[saber13812002](/maintainers/saber13812002)

---

Top Contributors

[![JaZo](https://avatars.githubusercontent.com/u/3475007?v=4)](https://github.com/JaZo "JaZo (69 commits)")[![bbrala](https://avatars.githubusercontent.com/u/3294970?v=4)](https://github.com/bbrala "bbrala (35 commits)")[![saber13812002](https://avatars.githubusercontent.com/u/3294604?v=4)](https://github.com/saber13812002 "saber13812002 (7 commits)")[![samberrry](https://avatars.githubusercontent.com/u/20775532?v=4)](https://github.com/samberrry "samberrry (6 commits)")[![vblinden](https://avatars.githubusercontent.com/u/1420356?v=4)](https://github.com/vblinden "vblinden (5 commits)")[![bingvanmoorsel](https://avatars.githubusercontent.com/u/4376490?v=4)](https://github.com/bingvanmoorsel "bingvanmoorsel (3 commits)")[![marijnz0r](https://avatars.githubusercontent.com/u/12230678?v=4)](https://github.com/marijnz0r "marijnz0r (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![PrinsFrank](https://avatars.githubusercontent.com/u/25006490?v=4)](https://github.com/PrinsFrank "PrinsFrank (2 commits)")[![RoachMech](https://avatars.githubusercontent.com/u/7983727?v=4)](https://github.com/RoachMech "RoachMech (1 commits)")[![mattdinthehouse](https://avatars.githubusercontent.com/u/6799224?v=4)](https://github.com/mattdinthehouse "mattdinthehouse (1 commits)")[![barryatswisnl](https://avatars.githubusercontent.com/u/18284224?v=4)](https://github.com/barryatswisnl "barryatswisnl (1 commits)")[![hpacleb](https://avatars.githubusercontent.com/u/24486552?v=4)](https://github.com/hpacleb "hpacleb (1 commits)")

---

Tags

laravel-fulltextsaber13812002

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/saber13812002-laravel-fulltext/health.svg)

```
[![Health](https://phpackages.com/badges/saber13812002-laravel-fulltext/health.svg)](https://phpackages.com/packages/saber13812002-laravel-fulltext)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[swisnl/laravel-fulltext

Fulltext indexing and searching for Laravel

184104.5k6](/packages/swisnl-laravel-fulltext)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)

PHPackages © 2026

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