- How do I install and set up maize-tech/laravel-searchable?
- Install it with composer require maize-tech/laravel-searchable, then add the Searchable trait to any Eloquent model you want to expose to search. Declare the searchable columns and relationships in a $searchable property on the model. No schema changes, index synchronization or queue workers are required, so a first integration is usually a sub-day task. Configuration publishing is optional if you want to override defaults.
- Which Laravel versions does laravel-searchable 4.2.0 support?
- Version 4.2.0 is a minor release whose only substantive change is declared compatibility with Laravel 13, with no breaking changes or deprecations. The package targets modern Laravel applications using Eloquent, roughly the 9 through 13 range. Check the composer.json constraint before upgrading to confirm support for your current major. The rest of the 4.2.0 diff is Dependabot bumps to CI-only GitHub Actions with no runtime footprint.
- How do I make an Eloquent model searchable?
- Add the Searchable trait to the model and define a $searchable property listing the attributes and relations that should participate in matching. You then call Model::search('term') as a static entry point, which returns a standard Eloquent query builder you can chain on. Because it returns a builder, you can paginate, order, select columns and apply additional constraints exactly as you would with any other query. Results come back structured and ready to render in list cards or a search page.
- Can laravel-searchable search across Eloquent relationships?
- Yes, relationships can be included in the $searchable declaration alongside plain columns, letting a single search hit related records. Under the hood this produces correlated subqueries or joins, so deep or multi-relation searches compound in cost. Duplicate parent rows can appear when matching related records, so plan on distinct or grouping where needed. Keep relation lists short and validate query plans against realistic data volumes.
- Does laravel-searchable provide relevance ranking, scoring or typo tolerance?
- No. Matching is database-native substring matching, and results come back as a normal query builder ordered by whatever you specify, so there is no scoring, boosting, prefix weighting or typo tolerance built in. If your product spec says best match first, you need custom ordering logic or a dedicated search engine. This is the deliberate trade-off that keeps the package dependency-free and fast to integrate for admin panels and back-office screens.
- How does laravel-searchable compare to Laravel Scout?
- This package is an in-process, database-native alternative to Scout: no Meilisearch, Algolia or Typesense, no index synchronization and no extra infrastructure. That makes it ideal for internal admin panels, MVPs and low-to-moderate data volumes where good enough substring matching is acceptable. Scout with Meilisearch is the better long-term bet when relevance ranking, typo tolerance, faceting or sub-100ms responses over millions of rows matter. If your stack already uses Scout, avoid running both abstractions on the same models.
- Can I limit results, filter which models are searched, and scope searches per tenant?
- Yes. The package supports wildcards, result limits and model filtering so you can restrict a search to specific models or cap the number of hits returned. Because search returns a plain Eloquent query builder, multi-tenant and other constraints compose naturally through global scopes or explicit where clauses. Validate that your tenant scope applies to every search entry point, including searches across multiple models. This is the main reason the trait fits existing Laravel authorization patterns well.
- What are the performance limits of laravel-searchable on large tables?
- Search is implemented with LIKE '%term%' predicates, and a leading wildcard defeats B-tree indexes, so every query is effectively a sequential scan. This looks fine in staging at 50k rows and can become a production incident at several million. Relationship searches add correlated subqueries or joins that compound the cost further. Before shipping, measure p95 latency against realistically sized data and confirm the expected row count and query rate at 12 and 24 months.
- How does laravel-searchable handle case sensitivity, accents, and % or _ characters in user input?
- Case and accent behaviour is delegated to the database collation rather than normalised in PHP, so results can differ between MySQL, PostgreSQL and SQLite, which many teams use for tests. Validate behaviour on your production engine, since test suites passing on SQLite do not guarantee parity. Literal % and _ in user input are interpreted as SQL wildcards unless escaped, which can silently widen result sets. Sanitise or escape user terms before passing them into search.
- Is maize-tech/laravel-searchable actively maintained, and what is the bus factor?
- It is a small, agency-backed package and recent change volume is dominated by Dependabot dependency bumps rather than feature work, so treat maintainer concentration as a genuine consideration. The runtime surface is small, though, and the trait builds only on stable Eloquent query builder APIs, which limits upgrade risk. Pin a tested version in composer.json and review changelogs before major Laravel upgrades. For teams needing vendor-backed SLAs and roadmapped relevance features, a Scout plus managed engine setup is the safer choice.