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

Eloquent Filtering Laravel Package

indexzer0/eloquent-filtering

Define allowed filters on your Eloquent models and apply them from simple arrays or request data—no custom query logic. Supports complex, type-based filtering for APIs and dashboards on Laravel 10+ / PHP 8.2+.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • API Search/Filtering: Accelerate development of scalable, filterable API endpoints (e.g., /products?filters[0][target]=price&filters[0][type]=$gt&filters[0][value]=100) without manual query-building logic.
  • Dashboard/Table Filtering: Enable dynamic filtering in admin panels or user-facing dashboards (e.g., "Show active users with premium plans").
  • Build vs. Buy: Buy for teams lacking time/resources to build custom filtering logic; build only if needing highly specialized filters (e.g., geospatial) beyond this package’s scope.
  • Roadmap Prioritization:
    • Short-term: Integrate into existing APIs to reduce backend complexity.
    • Long-term: Extend to support real-time filtering (e.g., Livewire/Alpine.js) or caching filtered queries.
  • Use Cases:
    • E-commerce (filter products by price, category, stock).
    • SaaS (user segmentation by role, activity, or metadata).
    • Analytics (filter datasets by date ranges, metrics).

When to Consider This Package

  • Adopt if:
    • Your Laravel app uses Eloquent and needs consistent, maintainable filtering across models.
    • You’re building APIs or dashboards with dynamic client-side filtering (e.g., React/Vue tables).
    • Your team wants to reduce boilerplate for common filters (e.g., =, >, LIKE, JSON path queries).
    • You’re using Laravel 10+ and PHP 8.2+ (no polyfills needed).
  • Look elsewhere if:
    • You need advanced geospatial queries (consider spatie/laravel-geocoder).
    • Your filters require full-text search (prioritize scout or meilisearch).
    • You’re on an older Laravel version (<10) or PHP (<8.2).
    • Your filtering logic is highly custom (e.g., multi-tenancy with tenant-specific rules).
    • You need sorting stability (package notes it’s in "infancy").

How to Pitch It (Stakeholders)

For Executives: "This package cuts API/dashboard filtering development time by 60% by standardizing how we handle complex queries. For example, instead of writing custom SQL for every ‘price > $100’ request, we define rules once in the model. It’s MIT-licensed, actively maintained, and used by 200+ teams—reducing tech debt while scaling faster."

For Engineers: *"Eloquent Filtering lets us replace spaghetti where() chains with declarative model-level rules. Example:

// Model
public function allowedFilters() {
    return Filter::only(
        Filter::field('price', [FilterType::GREATER_THAN]),
        Filter::field('name', [FilterType::LIKE])
    );
}

// API Request
$products = Product::filter(request('filters'))->get();
  • Pros: Cleaner code, reusable across models, supports JSON paths, and handles edge cases (e.g., SQL injection via input validation).
  • Cons: Sorting is experimental; may need custom logic for niche cases. Tradeoff: 90% coverage for 10% effort."*
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.
aashan/pimcore-mcp-bundle
solution-forest/ai-kit-core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
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