maldoinc/doctrine-filter

快速为使用 Doctrine 的任何资源添加高级过滤/搜索和排序功能。

v2.0.0 2024-04-11 20:43 UTC

This package is auto-updated.

Last update: 2024-09-21 11:28:00 UTC


README

快速为使用 Doctrine 的任何资源添加高级过滤和排序功能。

License PHP Version Require Version Unit tests Lint

要求
  • PHP >= 7.4
  • Doctrine >= 2.0

示例

价格在 100 到 200 之间的产品

GET /products?price[gte]=100&price[lte]=200

生日在 2000 年 1 月 1 日之后的用户

GET /users?birthday[gte]=2000-01-01

电子邮件以 gmail.com 结尾的用户

GET /users?email[ends_with]=gmail.com

订阅字段为空的客户

GET /customers?subscription[is_null]

按姓氏降序排序的用户

GET /users?orderBy[lastName]=desc

对于此查询,仅应用状态过滤器和对 id 降序排序。任何不在指定过滤器或 orderBy 格式中的键将被忽略

GET /todos?status[eq]=done&page=1&perPage=10&orderBy[id]=desc

文档

在此处阅读文档