Download the PHP package tijanidevit/query-filter without Composer
On this page you can find all versions of the php package tijanidevit/query-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tijanidevit/query-filter
More information about tijanidevit/query-filter
Files in tijanidevit/query-filter
Package query-filter
Short Description A simple, expressive, and powerful Laravel package that provides dynamic Eloquent models filters with clean syntax. It helps build reusable, maintainable, and readable query logic in Laravel apps.
License MIT
Informations about the package query-filter
Query Filter for Laravel
A simple, expressive, and powerful Laravel package that provides dynamic Eloquent model filters with clean syntax. It helps you build reusable, maintainable, and readable query logic in Laravel applications.
🎯 Why Use This Package?
In many Laravel applications—especially admin dashboards, reporting systems, and search pipelines—developers often repeat the same verbose filtering logic in controllers:
With Query Filter, you can simplify this down to a single, beautifully readable chain:
It safely ignores empty parameters automatically, so you never write an if (request()->filled(...)) block again.
🚀 Installation
Install the package via Composer:
(Optional) The package supports Auto-Discovery. If you are using an older version of Laravel (pre-5.5), manually register the provider in config/app.php:
Applying the Trait
Query Filter utilizes Laravel Scopes. To enable filtering on a model, add the Filterable trait:
⚡ Database Drivers & ILIKE Support
The package dynamically detects your database connection. If you are using PostgreSQL, all search(), searchIn(), orSearch(), and searchByRelation() methods will automatically utilize the case-insensitive ILIKE operator. For all other SQL databases (MySQL, SQLite), it will default natively to LIKE.
📚 Available Filters
filterBy()
Filter by a single column or multiple columns using exact matches.
filterByRelation()
Filter directly using nested related models cleanly without verbose whereHas queries.
filterWhereIn()
Flexible WHERE IN filtering parsing arrays and strings automatically.
search(), searchIn(), and orSearch()
Powerful dynamic LIKE search abstractions.
filterFromRequest()
Automatically bind constraints directly from incoming HTTP Request objects by mapping input keys to database columns.
filterByDate(), filterByMonth(), filterByYear(), filterByDateRange()
Timezone-aware date parsing spanning specific bounding frames neatly.
Sorting Helpers
Chainable dynamic chronological sorting bounds.
💡 Advanced Best Practices
Query Filter macros are designed to act composably, linking infinitely together parsing structural queries perfectly.
The "God Query" Approach
For complex Admin panels parsing 15 distinct variables simultaneously, combine macros sequentially:
Structural Security Recommendations
- Always validate request inputs before blindly dumping
request()into maps. - Use arrays or comma-delimited structures intelligently parsed with
filterWhereIn()bridging dashboard parameters structurally. - Funnel heavy endpoint evaluations entirely into
filterFromRequest()maps for ultra-slim API Controllers.
🛠 Requirements
- Laravel 9, 10, or 11+
- PHP 8.0+
📄 License
This package is open-sourced software licensed under the MIT license.