https://github.com/abbasudo/laravel-purity
An elegant way to filter and sort queries in Laravel
https://github.com/abbasudo/laravel-purity
eloquent filter filtering filters laravel mysql php queries sort sql
Last synced: 7 days ago
JSON representation
An elegant way to filter and sort queries in Laravel
- Host: GitHub
- URL: https://github.com/abbasudo/laravel-purity
- Owner: abbasudo
- License: mit
- Created: 2023-02-20T00:52:05.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-05-16T16:22:15.000Z (7 months ago)
- Last Synced: 2025-11-15T00:18:24.497Z (about 1 month ago)
- Topics: eloquent, filter, filtering, filters, laravel, mysql, php, queries, sort, sql
- Language: PHP
- Homepage: https://abbasudo.github.io/laravel-purity/?utm_source=github&utm_medium=about
- Size: 1.29 MB
- Stars: 511
- Watchers: 6
- Forks: 56
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Elegant way to filter and sort queries in Laravel
[](https://github.com/abbasudo/laravel-purity/actions/workflows/tests.yml)
[](https://github.com/abbasudo/laravel-purity)
[](https://packagist.org/packages/abbasudo/laravel-purity)
[](https://packagist.org/packages/abbasudo/laravel-purity)
[](https://packagist.org/packages/abbasudo/laravel-purity)
Laravel Purity is an elegant and yet simple filtering and sorting package for Laravel,
designed to simplify complex data filtering and sorting logic for eloquent queries.
By simply adding `filter()` to your Eloquent query,
you can add the ability for frontend users to apply filters based on URL query string parameters like a breeze.
## How Does Purity Work?
Here is a basic usage example to clarify Purity's use case.
Add `filter()` to your query.
```php
$posts = Post::filter()->get();
```
That's it!
Now you can filter your posts by adding query string parameters to the URL.
```
GET /api/posts?filters[title][$contains]=Purity
```
read more at official [documentations](https://abbasudo.github.io/laravel-purity/)
## Documentation
https://abbasudo.github.io/laravel-purity/
## License
Laravel Purity is Licensed under The MIT License (MIT). Please see [License File](https://github.com/abbasudo/laravel-purity/blob/master/LICENSE) for more information.
## Security
If you've found a bug regarding security, please mail [amkhzomi@gmail.com](mailto:amkhzomi@gmail.com) instead of
using the issue tracker.