maldoinc / doctrine-filter
Quickly add advanced filtering/searching and sorting capabilities to any resource in your APIs or Web apps that use Doctrine.
Installs: 5 875
Dependents: 0
Suggesters: 0
Security: 0
Stars: 57
Watchers: 3
Forks: 4
Open Issues: 3
Requires
- php: ^7.4|^8
- doctrine/orm: ^2
Requires (Dev)
- friendsofphp/php-cs-fixer: 3.*
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9
- symfony/cache: 5.*
This package is auto-updated.
Last update: 2024-12-21 12:04:36 UTC
README
Quickly add advanced filtering and sorting capabilities to any resource in your APIs or Web apps that use Doctrine.
Requirements
- PHP >= 7.4
- Doctrine >= 2.0
Examples
Products with a price range between 100 and 200
GET /products?price[gte]=100&price[lte]=200
Users with a birthday after 1 Jan 2000
GET /users?birthday[gte]=2000-01-01
Users with an email ending with gmail.com
GET /users?email[ends_with]=gmail.com
Customers whose subscription field is null
GET /customers?subscription[is_null]
Users ordered by their last name in descending order
GET /users?orderBy[lastName]=desc
For this query only the status filter and order by id desc will be applied. Any keys not in the specified filter or orderBy format will be ignored
GET /todos?status[eq]=done&page=1&perPage=10&orderBy[id]=desc