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
Laravelfilters

Laravelfilters Laravel Package

tiagomichaelsousa/laravelfilters

Laravel Filters lets you filter Eloquent models directly from query strings. Define reusable filter classes, attach them to models with a simple trait, and compose filters per request. Includes artisan generators for creating filters quickly, keeping controllers clean and queries readable.

View on GitHub
Deep Wiki
Context7

Filter your eloquent models in a clean way! 🚀

Frequently asked questions about Laravelfilters
How do I install LaravelFilters in a Laravel application?
Install the package with Composer using tiagomichaelsousa/laravelfilters. For Laravel 11 or 12 applications, pin the v1.7 release line and confirm the resolved illuminate and PHP constraints in your lockfile. The package is additive and does not require schema changes or migrations for a first pilot.
Which Laravel versions does LaravelFilters support?
Version 1.7.0 is described as adding Laravel 11 support and Laravel 12.x compatibility, but the changelog wording is ambiguous about whether older Laravel versions remain supported. The authoritative answer is the illuminate/support constraint in the package composer.json. Verify that constraint before upgrading, especially if you are still on Laravel 10 or earlier.
How do I create a new filter class with LaravelFilters?
LaravelFilters includes Artisan generators intended to create filter classes quickly. Use the package generator to scaffold the filter, then implement the filtering logic for the query-string keys you want to support. Keeping each filter focused makes the class easier to reuse and test.
How do I attach filters to an Eloquent model?
Apply the package trait to the Eloquent model or query builder you want to filter, then compose the relevant filter classes per request. This keeps controllers cleaner and moves reusable query logic into dedicated filter classes. Adoption can be incremental, model by model, without disrupting existing inline filtering.
Can LaravelFilters filter relationships or nested queries?
The provided overview and release notes do not confirm built-in support for relation or nested filtering. Before relying on it, check the package documentation and test behavior against your actual relationship queries. If relation filtering is not covered, you can supplement it with your own filter classes or existing query scopes.
Does LaravelFilters validate query-string input or allowlist filter keys?
Built-in query-string validation and allowlisted filter keys are not confirmed by the overview or changelog. Treat those as requirements to verify in the documentation and tests before using the package on public endpoints. Many teams will still want request-level validation and an explicit allowlist around any filter composition.
Is LaravelFilters safe to use in production?
The package is architecturally a low-risk insertion point because it sits above Eloquent and can be adopted per model, but it is a single-maintainer project with a small contributor base. Pin a known version, run a regression pass on existing filters, and confirm the Composer constraints against your Laravel version. Also verify whether a tagged security or support policy exists for your maintenance window.
How should I test filters built with LaravelFilters?
Write unit tests for individual filter classes and feature tests that exercise the actual endpoints with representative query strings. Because filters are reusable classes attached to models, they can be tested independently of controllers. Include regression tests when upgrading Laravel or changing package constraints.
Does LaravelFilters support PHP 8.2, 8.3, or 8.4?
The v1.7.0 release notes do not state a PHP version floor, CI matrix, or security policy update, so PHP 8.2, 8.3, and 8.4 support is not confirmed from the provided context. Check the php constraint in composer.json and the package test matrix. Treat PHP compatibility as a verification step before rollout.
How does LaravelFilters compare with Spatie query builder or existing query scopes?
LaravelFilters is a thin abstraction for declarative Eloquent filtering through reusable filter classes. If your application already uses Spatie query builder or a consistent first-party filtering pattern, adding this package may create a second filtering idiom without enough marginal benefit. It is a better fit when controllers contain ad-hoc when clauses or duplicated query scopes that need consolidation and testability.
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.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core