Download the PHP package clydescobidal/larasearch without Composer
On this page you can find all versions of the php package clydescobidal/larasearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clydescobidal/larasearch
More information about clydescobidal/larasearch
Files in clydescobidal/larasearch
Package larasearch
Short Description A Laravel package that provides FULLTEXT index search functionality
License MIT
Homepage https://github.com/clydescobidal/larasearch
Informations about the package larasearch

Larasearch
The goal of this Laravel package is to offer fast FULLTEXT indexed searches. This is only relevant if you wish to include a basic search feature in your project. However, if your project has a large amount of data that needs to be searched and is frequently used, search engines like Typesense, ElasticSearch, Algolia, and similar ones are more appropriate.
Search queries are executed on the searchable table to save your main table from the heavy search workload.
Features
- FULLTEXT index search
- Cached results
Installation
You can install the package via composer:
Publish the configuration file:
Run migration:
Usage
Add the Clydescobidal\Larasearch\Searchable
trait to the model you would like to make searchable. Models that are using this trait will be indexed in the searchable table whenever changes are made on the model.
Search for posts and chain query builder methods as normal:
Make model searchable or unsearchable:
Commands
You can run the command below if you want to make all your models searchable. Note that this will only work on models with Clydescobidal\Larasearch\Searchable
trait. This is applicable when you first install the package and you want your existing models to be searchable, or when you want to do a batch reindex of a model.
In this example, we will make all instances of App\Models\Post
searchable.
We can also do a batch unsearchable on a model.
Config
Property | Type | Default | Description |
---|---|---|---|
table | string | searchable | The table where the searchable indices are stored |
cache | boolean | true | Enable caching of results |
queue | boolean | true | Run searchable syncs in queue (recommended) |
Cache
By default, search query results are cached. You can turn this off by setting the cache
property in the configuration. In any case you want to clear the cached results, you can run the artisan command:
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.