awesome-repositories.com
博客
MCP
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目MCP 服务器关于排名机制媒体报道
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
spatie avatar

spatie/laravel-query-builder

0
View on GitHub↗
4,453 星标·411 分支·PHP·MIT·6 次浏览spatie.be/docs/laravel-query-builder↗

Laravel Query Builder

本项目是一个用于 Laravel 应用程序的 Eloquent 查询构建器封装器和 REST API 查询解析器。它将 HTTP 请求参数转换为数据库查询,为 API 端点提供动态过滤、排序和关系加载。

该系统通过基于别名的模式抽象将外部 API 接口与存储层解耦,允许公共字段名映射到私有数据库列。它支持嵌套关系的动态包含和聚合计数,以及通过可调用类和闭包为过滤器和排序执行自定义程序逻辑。

功能覆盖面包括通过字段选择进行数据投影,以及基于请求参数的结果排序。它进一步提供了使用点符号进行基于关系的过滤的机制,与本地模型作用域的集成,以及对软删除记录可见性的控制。

Features

  • Eloquent Query Wrappers - Translates HTTP request parameters into complex database queries using the Eloquent ORM for Laravel applications.
  • Query Parameter Filters - Translates URL query parameters into database filters supporting partial matches, exact matches, and logical groupings.
  • Query Parameter Filters - Translates request parameters into complex database filters using AND/OR logical conjunctions.
  • Dataset Filtering and Search - Provides mechanisms for end users to refine and search through large datasets using dynamic filters and logical groupings.
  • Dynamic Relationship Loading - Loads specified relationships and nested relations based on parameters passed in the request.
  • Dot-Notation Join Paths - Parses nested relationship identifiers using dot-notation to generate database JOIN clauses and filters.
  • Field Selection - Limits the columns returned by a database query based on parameters specified in the request URL.
  • Model Scope Integration - Maps URL filter parameters directly to local Eloquent model scopes.
  • Association-Based Filters - Provides mechanisms to filter records based on attributes of their associated relationships using dot-notation.
  • Eager Loading - Dynamically injects eager loading constraints into the query builder based on requested relation identifiers.
  • Query Sorting - Orders query results based on request parameters, supporting multiple columns, directions, and fallbacks.
  • Dynamic Relation Loaders - Dynamically includes nested database relationships and aggregate counts based on API request parameters.
  • Dynamic Relationship Loading - Allows API clients to specify which nested relationships and aggregate counts should be included in the response.
  • Query Builders - Translates HTTP request parameters into Eloquent database queries for API filtering, sorting, and including.
  • Model Scoping - Triggers local Eloquent model scopes by mapping request parameters to predefined model-level query methods.
  • Request-to-Query Predicate Mapping - Translates HTTP request parameters directly into database query predicates for dynamic filtering.
  • Schema Abstraction Layers - Maps public API field names to private database column names to decouple the external interface from storage.
  • API Query Filtering - Maps URL query strings to database constraints to provide dynamic data filtering for API endpoints.
  • REST API Query Parsers - Builds API endpoints that allow clients to filter, sort, and include related data directly via URL query parameters.
  • Field Aliasing - Hides internal database column names from API consumers by mapping request parameters to specific table fields.
  • Custom Relationship Loaders - Supports executing custom closures or classes to modify the query builder when specific relationships are requested.
  • Sort Field Aliasing - Maps request parameters to internal database columns to hide the underlying schema from API consumers.
  • Relationship Count Aggregators - Attaches relationship counts and aggregate values from associated models to the primary result set.
  • Soft-Delete Query Overrides - Allows API requests to override default soft-delete filters to include or exclude trashed records.
  • Invokable Sorting Classes - Delegates complex ordering requirements to dedicated classes that manually modify the query builder's order clauses.
  • Custom Sorting Logic - Implements arbitrary sorting logic via invokable classes for requirements like string length or raw SQL expressions.
  • Closure-Based Query Constraints - Applies custom database constraints by executing registered closures when specific filter keys are detected.
  • Complex Query Filtering Logic - Enables the execution of custom programmatic logic to apply complex constraints to the database query builder.
  • Query Filtering Integrations - Implements advanced search and sorting logic within Laravel applications using declarative request-based rules.

Star 历史

spatie/laravel-query-builder 的 Star 历史图表spatie/laravel-query-builder 的 Star 历史图表

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI

Laravel Query Builder 的开源替代方案

相似的开源项目,按与 Laravel Query Builder 的功能重合度排序。
  • prettus/l5-repositoryprettus 的头像

    prettus/l5-repository

    4,205在 GitHub 上查看↗

    This project is a repository pattern library for Laravel applications designed to decouple business logic from database queries and storage implementation. It provides a standardized data access layer to isolate application logic from the underlying storage layer. The library includes a query filter system that translates HTTP request parameters into dynamic database filters, search criteria, and sorting logic. It features an API presenter layer to separate internal data structures from client responses and a cache manager that automatically refreshes stored database results when records are

    PHP
    在 GitHub 上查看↗4,205
  • jeremyevans/sequeljeremyevans 的头像

    jeremyevans/sequel

    5,076在 GitHub 上查看↗

    Sequel is a relational database toolkit for Ruby that provides object-relational mapping, a fluent SQL query builder, and schema migration capabilities. It maps database tables to Ruby classes with support for associations, validations, lifecycle hooks, and eager loading, offering a comprehensive ORM layer for building data-centric applications. Sequel distinguishes itself through a plugin-based extension architecture that allows composable customization of models, databases, and datasets without relying on deep inheritance hierarchies. It includes a thread-safe connection pool with support f

    Ruby
    在 GitHub 上查看↗5,076
  • carltongibson/django-filtercarltongibson 的头像

    carltongibson/django-filter

    4,683在 GitHub 上查看↗

    django-filter is a library for filtering Django QuerySets by mapping URL parameters to database lookups using declarative syntax. It functions as a model filter generator and a database lookup tool that translates request parameters into queries to refine data results. The project enables the automatic generation of search filters and user-facing forms based on model field definitions. It supports advanced retrieval logic through custom lookup methods, relationship paths, and full-text search integration, while providing a system for refining results within REST API endpoints. Its capability

    Python
    在 GitHub 上查看↗4,683
  • nestjsx/crudnestjsx 的头像

    nestjsx/crud

    4,330在 GitHub 上查看↗

    This project is a REST API framework for NestJS designed to automate the creation of boilerplate-free CRUD endpoints and resource management. It functions as an automated CRUD generator that produces controllers and services for standard database operations, accelerating the development of RESTful APIs. The toolkit includes a REST query parser that translates complex URL parameters into structured database filters, pagination, and sorting rules. It also operates as an API response serializer to control the exposure of entity fields and manage nested relations within JSON responses. For extend

    TypeScriptcrudcrud-generatornest
    在 GitHub 上查看↗4,330
查看 Laravel Query Builder 的所有 30 个替代方案→

常见问题解答

spatie/laravel-query-builder 是做什么的?

本项目是一个用于 Laravel 应用程序的 Eloquent 查询构建器封装器和 REST API 查询解析器。它将 HTTP 请求参数转换为数据库查询,为 API 端点提供动态过滤、排序和关系加载。

spatie/laravel-query-builder 的主要功能有哪些?

spatie/laravel-query-builder 的主要功能包括:Eloquent Query Wrappers, Query Parameter Filters, Dataset Filtering and Search, Dynamic Relationship Loading, Dot-Notation Join Paths, Field Selection, Model Scope Integration, Association-Based Filters。

spatie/laravel-query-builder 有哪些开源替代品?

spatie/laravel-query-builder 的开源替代品包括: prettus/l5-repository — This project is a repository pattern library for Laravel applications designed to decouple business logic from… jeremyevans/sequel — Sequel is a relational database toolkit for Ruby that provides object-relational mapping, a fluent SQL query builder,… carltongibson/django-filter — django-filter is a library for filtering Django QuerySets by mapping URL parameters to database lookups using… nestjsx/crud — This project is a REST API framework for NestJS designed to automate the creation of boilerplate-free CRUD endpoints… prest/prest — PostgREST is a tool that automatically transforms a PostgreSQL database schema into a production-ready RESTful API. It… doctrine/orm — Doctrine ORM is a PHP object-relational mapper that connects application objects to relational database tables. It…