Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Searchable

Laravel Searchable Laravel Package

h-farm/laravel-searchable

Laravel Searchable by h-farm adds simple, driver-based full-text search to Eloquent models, letting you index records and run clean, reusable search queries with minimal setup in Laravel applications.

View on GitHub
Deep Wiki
Context7

Easily add weighted searches through model attributes and relationships

Frequently asked questions about Laravel Searchable
How do I install and set up laravel-searchable in a Laravel application?
Install it with Composer using the h-farm/laravel-searchable package, then add the Searchable trait to the Eloquent model you want to index and configure a search driver. The package is designed as a low-friction native Laravel integration with no external service to provision, daemon to run, or extra credentials to manage. Check the package README for the exact configuration keys and migration steps, then backfill existing records before running queries.
Which search drivers does laravel-searchable support?
It ships with pluggable drivers, including a database-backed driver and a collection-backed driver. The database driver keeps search inside your existing database and connection, while the collection driver works over collection data. You select the driver in configuration, and the trait handles indexing and querying through that driver.
Does laravel-searchable support Laravel 13?
Yes, version 4.2.0 adds Laravel 13 support, and earlier releases cover prior Laravel versions. Because framework support changes can widen the illuminate/* constraints, pin both the package and framework versions explicitly and confirm the resolved PHP floor for your runtime. Review the release notes before upgrading so you know which Laravel versions are still supported.
How does laravel-searchable keep the search index in sync with model changes?
Index synchronisation is driven by Eloquent model events, so normal create, update and delete operations on a searchable model update its index automatically. Bulk inserts, upserts, raw SQL writes, and queue workers running with withoutEvents can bypass those events and cause index drift. Schedule periodic reindexing or handle those write paths explicitly to keep the index consistent.
Can laravel-searchable search across relationships and weighted attributes?
Yes, the package's core purpose is weighted full-text search through model attributes and relationships. You define which attributes and relations are searchable and assign weights so more important fields contribute more to the search results. The query API is designed to be clean and reusable while staying within the Eloquent mental model.
What are the limitations of laravel-searchable compared with Meilisearch or Elasticsearch?
laravel-searchable is aimed at modest search requirements and small-to-mid datasets, roughly low millions of rows with read-heavy access. It does not provide relevance ranking, faceting, fuzzy matching, typo tolerance, or multilingual analysis, which require a dedicated search engine such as Elasticsearch, Meilisearch or Algolia. If those requirements appear later, expect to replace the driver layer and reindex your data.
How do I reindex or backfill existing records with laravel-searchable?
You need a backfill or reindex procedure to populate the index for records that existed before the trait was added. Run the package's documented procedure against production-sized data in staging first so you can measure duration and write amplification. Because indexing is event-driven, a full reindex is also the practical recovery path for index drift.
Will laravel-searchable cause table scans or performance problems on large tables?
The database-backed driver typically translates searches into LIKE-style predicates, so unscoped searches on large tables can table-scan and compete with your primary OLTP workload. Keep searchable models on moderate-cardinality, low-traffic tables where possible, and scope queries to limit the rows examined. If search volume or dataset size grows beyond low millions of rows, evaluate a dedicated search engine.
Is laravel-searchable actively maintained, and what happens if it is abandoned?
The release history is effectively single-maintainer and the vendor is small, so maintainer concentration and bus factor are the dominant long-term risks rather than code quality. The 4.2.0 release is a small functional change plus CI dependency bumps, which suggests low-churn maintenance. Decide internally who would own a fork if upstream goes dormant, and assume forking may be needed.
Can I use laravel-searchable with soft deletes, bulk inserts, or queue workers?
Soft deletes and any write path that bypasses Eloquent events, including bulk upsert or insert, raw SQL, and queue workers using withoutEvents, are classic sources of index drift. Confirm how soft-delete semantics are represented in your index and add explicit reindexing or event handling for those paths. A scheduled reindex job is a practical safety net for these cases.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core