Weave Code
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 Package

mozex/laravel-searchable

Add a Searchable trait to any Eloquent model to search multiple columns and related data (relations, morphs, even cross-database) via a single ->search() call. Works with Laravel Scout and includes optional Filament table/global search integration.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature Development: Enables advanced search functionality across Eloquent models without requiring a dedicated search engine (e.g., Scout + Meilisearch). Ideal for projects where SQL-based search suffices and avoids vendor lock-in.
  • Roadmap Prioritization: Justifies investing in internal search features over third-party solutions for teams prioritizing cost efficiency, data control, or compliance (e.g., GDPR).
  • Build vs. Buy: Favors "build" for lightweight search needs (e.g., admin panels, internal tools) where Scout/Algolia would be overkill. Reduces dependency on external APIs.
  • Use Cases:
    • Multi-column search: Replace manual whereLike chains with a single search() call.
    • Relation-aware search: Search nested attributes (e.g., author.name, tags.name) without manual joins.
    • Polymorphic search: Query morph relations (e.g., commentable:post.title) in one scope.
    • Filament integration: Add global/searchable columns to admin panels with minimal effort.
    • Cross-database search: Handle multi-tenant or sharded setups where relations span databases.

When to Consider This Package

  • Adopt if:

    • Your search queries are SQL-based (no need for full-text indexing or fuzzy matching).
    • You’re using Laravel Scout but want fallback SQL search for edge cases (e.g., offline modes).
    • Your dataset is small-to-medium (<1M rows) or filtered heavily (e.g., by tenant_id).
    • You need relation-aware search (e.g., searching a user’s posts + their profile name).
    • Your team prefers avoiding external dependencies (e.g., Algolia, Meilisearch).
    • You’re using Filament and want seamless table/global search.
  • Look elsewhere if:

    • You need high-performance search (e.g., autocomplete, typo tolerance) → Use Scout + Meilisearch/Typesense.
    • Your tables exceed millions of rows → SQL LIKE '%term%' becomes prohibitively slow.
    • You require advanced ranking/scoring (e.g., BM25) → Dedicated search engines excel here.
    • Your schema is highly dynamic (e.g., frequent column changes) → Scout’s index rebuilds may be preferable.
    • You’re locked into case-sensitive search or non-standard collations → Manual where clauses may be needed.

How to Pitch It (Stakeholders)

For Executives: "This package lets us add powerful, SQL-based search to our Laravel apps without external costs or dependencies. It’s perfect for internal tools, admin panels, or lightweight public-facing search where speed isn’t critical. For example, we could replace manual whereLike queries across 5+ columns with a single Model::search('term') call—saving dev time and reducing technical debt. It also integrates natively with Filament, so our admin team can search across related data (e.g., posts + authors) without writing custom queries. Best of all, it’s a one-time dependency with no ongoing fees."

For Engineering: *"Laravel Searchable provides a trait-based solution for multi-column, relation-aware search in Eloquent. Key benefits:

  • Unified API: Replace scattered whereLike calls with Model::search().
  • Relation support: Search nested attributes (e.g., author.name, tags.name) via dot notation.
  • Polymorphic/multi-db: Handles morph relations and cross-database joins automatically.
  • Filament-ready: Adds global/searchable columns to tables with minimal setup.
  • Scout-compatible: Works alongside Scout for hybrid search strategies. Tradeoff: Uses LIKE '%term%', so performance degrades with large datasets. Ideal for <1M rows or filtered queries. For bigger scales, we’d pair this with Scout + Meilisearch."*
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky