indexzer0 / eloquent-filtering
Powerful eloquent filtering
Fund package maintenance!
IndexZer0
Installs: 2 589
Dependents: 0
Suggesters: 0
Security: 0
Stars: 173
Watchers: 4
Forks: 3
Open Issues: 3
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^3.0.0
- pestphp/pest-plugin-arch: ^3.0.0
- pestphp/pest-plugin-laravel: ^3.0.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2024-11-19 00:11:02 UTC
README
Easily filter eloquent models using arrays
Eloquent Filtering simplifies implementing search functionality for your Eloquent models, whether simple or complex, by eliminating the need for custom query logic. It allows you to easily define and manage filters directly within your models, and seamlessly apply them using incoming HTTP request data to dynamically filter your models.
With this package, you can build more readable, maintainable, and scalable code, boosting your productivity and speeding up development.
Whether you’re building APIs, dashboards, or advanced search systems, Eloquent Filtering provides a powerful and flexible way to streamline your Eloquent queries, making it easier to manage and extend your application’s filtering capabilities.
View The Docs
Quick Look
class Product extends Model implements IsFilterable { use Filterable; public function allowedFilters(): AllowedFilterList { return Filter::only( Filter::field('name', [FilterType::EQUAL]), ); } } $products = Product::filter([ [ 'target' => 'name', 'type' => '$eq', 'value' => 'TV' ] ])->get();
Requirements
- PHP Version >=
8.2
- Laravel Version >=
10
Installation
You can install the package via composer:
composer require indexzer0/eloquent-filtering
Run the install
artisan command to publish the config:
php artisan eloquent-filtering:install
Testing
composer test
Docs
npm i -g mintlify
cd docs
mintlify dev
Changelog
Please see CHANGELOG for more information on what has changed recently.
Feature Ideas
Please see Feature ideas for potential future features.
Credits
License
The MIT License (MIT). Please see License File for more information.