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 is sufficient or where external search services are cost-prohibitive.
  • Roadmap Prioritization: Justifies delaying or deprioritizing full-text search engine integration (e.g., Algolia, Typesense) for projects with smaller datasets or simpler search requirements.
  • Build vs. Buy: Eliminates the need to build custom search logic for multi-column, relation, or polymorphic searches, reducing development time and technical debt.
  • Use Cases:
    • Internal admin panels (e.g., Filament-based dashboards) where global search or table-level filtering is needed.
    • Applications with polymorphic relationships (e.g., comments on posts/videos) requiring unified search across disparate models.
    • Cross-database scenarios where relations span multiple database connections (e.g., microservices or multi-tenant setups).
    • Projects where Scout’s overhead (e.g., indexing, syncing) is unnecessary for lightweight search needs.

When to Consider This Package

  • Adopt When:

    • Your dataset is <1M rows per table, and search performance is acceptable with LIKE '%term%' queries.
    • You need multi-column, relation, or polymorphic search without external dependencies.
    • Your team lacks resources to maintain a dedicated search engine (e.g., Scout + Meilisearch).
    • You’re using Filament and want seamless table/global search integration.
    • Cross-database relations exist, and you need to search across them without complex joins.
    • Case-insensitive search is sufficient (or you can adjust database collations).
  • Look Elsewhere When:

    • Performance is critical: For large datasets (>1M rows), LIKE '%term%' becomes prohibitively slow. Switch to Scout + a dedicated search engine (e.g., Typesense, Algolia).
    • Advanced full-text features are needed: Stemming, fuzzy matching, or synonyms require specialized search engines.
    • Real-time search is required: Database searches are slower than indexed search engines for high-frequency queries.
    • You’re already using Scout: If you’ve invested in Scout, this package adds redundancy unless you need its unique features (e.g., morph relation support).
    • Case-sensitive or accent-insensitive search is mandatory: The package relies on database-level collations, which may not meet all i18n requirements.

How to Pitch It (Stakeholders)

For Executives: "This package lets us add powerful, SQL-based search across our entire application—including complex relationships—without the cost or complexity of a dedicated search engine. It’s perfect for internal tools, admin panels, or projects where search is secondary to core functionality. For example, we can unify search across comments on posts/videos or filter cross-database records in Filament dashboards, all while keeping infrastructure simple and low-maintenance. It’s a ‘build vs. buy’ win: we avoid the overhead of Scout/Algolia while delivering 80% of the search utility for 20% of the effort."

For Engineers: "Laravel Searchable gives us a drop-in trait to enable multi-column, relation, and polymorphic searches with zero config. It plays nicely with Filament for global/table search and handles edge cases like cross-database relations out of the box. For small-to-medium datasets, it’s faster to implement than Scout + Meilisearch and avoids external dependencies. The only tradeoff is performance at scale—if we hit that, we can always migrate to Scout later. It also resolves naming conflicts with Scout’s search() method cleanly, so we can coexist if needed."

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.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony