承接 jurager/filterable 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jurager/filterable

Composer 安装命令:

composer require jurager/filterable

包简介

Laravel package for building complex eloquent filters in a simple, structured way

README 文档

README

Latest Stable Version Total Downloads PHP Version Require License

A Laravel package that adds JSON:API-compatible filter and sort query parameter support to Eloquent models.

Features:

  • Declarative $filterable and $sortable arrays on the model — no boilerplate controllers
  • Full operator set: eq, ne, gt, gte, lt, lte, like, in, nin, null, not_null, between, not_between, tree
  • Relation filtering via whereHas subqueries and pivot column support
  • Filtered eager-loading with filter[included.*]
  • OR / AND condition groups
  • Field, relation, and sort resolver interfaces for custom SQL
  • Full-result caching (Redis / Memcached) with automatic tag-based invalidation
  • Entity-Attribute-Value attribute filtering via jurager/eav resolver
  • NestedSet descendant expansion via the tree operator

Requirements

  • PHP 8.2+
  • Laravel 11+

Installation

composer require jurager/filterable

Add HasFilterable to your model and declare allowed fields:

use Jurager\Filterable\Concerns\HasFilterable;

class Product extends Model
{
    use HasFilterable;

    protected array $filterable = [
        'sku'             => ['eq', 'like'],
        'price'           => ['gte', 'lte', 'between'],
        'status'          => ['eq', 'in'],
        'category.name'   => ['eq', 'like'],
        'is_active',
    ];

    protected array $sortable = ['id', 'sku', 'price', 'created_at'];
}

Apply in the controller:

Product::query()->filter()->sort()->paginate();

Request:

GET /products?filter[status][in][]=active&filter[price][gte]=100&sort=-created_at

Documentation

To learn more about filtering, sorting, relations, caching, and advanced usage please go to the Documentation.

License

This package is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固