kevinoo/graphql-laravel-filters
Composer 安装命令:
composer require kevinoo/graphql-laravel-filters
包简介
This library extends the functionalities of rebing/graphql-laravel, providing a comprehensive solution for managing pagination and applying advanced filters to GraphQL queries in Laravel applications.
关键字:
README 文档
README
This library extends the functionalities of "rebing/graphql-laravel," providing a comprehensive solution for managing pagination and applying advanced filters to GraphQL queries in Laravel applications.
Installation
Use Composer to install the library:
composer require kevinoo/graphql-laravel-filters
Usage
To utilize pagination in GraphQL queries, simply extend the AbstractPaginateQuery class provided by this library and use it in query resolvers.
use kevinoo\GraphQL\Queries; class MyCustomModelQuery extends AbstractPaginateQuery { // public const GENERIC_FILTERS = true; // public const TRASHED_FILTER = true; // public const MAX_LIMIT_RESULTS = 1000; protected $attributes = [ 'name' => 'Name of Query', ]; public function getGraphQLType(): string { return 'Your GraphQL Type'; } public function args(): array { return parent::args() + [ 'filters' => [ 'type' => GraphQL::type('Your GraphQL FilterInput'), ], ]; } protected function resolveModelBuilder( array $args ): Builder { $builder = YourModel::query(); $order_by = ($args['orders'] ?? []) ?: ['domain'=>'ASC']; foreach( $order_by as $column => $direction ){ $builder->orderBy($column,$direction); } return $builder; } protected function getGenericFiltersKeys(): array { return [ 'your_input_key_1' => 'model_attribute_1', // Input value can be string, int, boolean or array 'your_input_key_2' => new AdvancedSearch('model_attribute_to_apply_advanced_search'), 'your_input_key_3_array' => 'model_attribute_2', ]; } protected function getPipelineFiltersSteps(): array { return parent::getPipelineFiltersSteps() + [ // Add your other custom filters class ]; } }
Contributing
You are welcome to contribute to the project!
kevinoo/graphql-laravel-filters 适用场景与选型建议
kevinoo/graphql-laravel-filters 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 04 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「laravel」 「react」 「graphql」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kevinoo/graphql-laravel-filters 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kevinoo/graphql-laravel-filters 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kevinoo/graphql-laravel-filters 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Async Reactive Postgres Driver for PHP (Non-blocking)
Laravel integration for blade-to-react
A simple, flexible Laravel package for adding polymorphic reactions to any model. React with any text: like, love, care, or anything you want.
This library tries to create a simple promise factory standard while waiting for a psr.
Alfabank REST API integration
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-02