riddlestone/brokkr-graphql
Composer 安装命令:
composer require riddlestone/brokkr-graphql
包简介
Laminas-based GraphQL integration
README 文档
README
This module provides an endpoint and plugin managers to assist with development of a Laminas-based GraphQL solution.
Endpoint
A placeholder route is provided to the router for the GraphQL endpoint, named
graphql. It can be overridden using router config:
# module config return [ 'router' => [ 'routes' => [ 'graphql' => [ 'type' => 'literal', 'options' => [ 'route' => 'api/graphql' ], ], ], ], ];
Types
Types can be registered with the GraphQLTypeManager through configuration:
# module config return [ 'graphql_types' => [ 'factories' => [ 'My\\TypeClass' => 'My\\TypeClassFactory', ], ], ];
Alternatively you can deal with the manager directly:
use Laminas\ServiceManager\ServiceManager; use Riddlestone\Brokkr\GraphQL\Types\GraphQLTypeManager; /** @var ServiceManager $serviceManager */ /** @var GraphQLTypeManager $typeManager */ $typeManager = $serviceManager->get(GraphQLTypeManager::class); $typeManager->setFactory('My\\TypeClass', 'My\\TypeClassFactory');
Fields
Fields can be registered with the GraphQLFieldManager, through configuration
or directly.
# module config return [ 'graphql_fields' => [ 'factories' => [ 'My\\FieldClass' => 'My\\FieldClassFactory', ], ], ];
use Laminas\ServiceManager\ServiceManager; use Riddlestone\Brokkr\GraphQL\Fields\GraphQLFieldManager; /** @var ServiceManager $serviceManager */ /** @var GraphQLFieldManager $fieldManager */ $fieldManager = $serviceManager->get(GraphQLFieldManager::class); $fieldManager->setFactory('My\\FieldClass', 'My\\FieldClassFactory');
Note that fields do not need to be registered to use them in types, but will need to be registered for use as root query fields.
In order for fields to be available as a root element in a query, they need to be registered as query fields with the field manager through configuration.
You can optionally set the field name using the array key. This can be useful when reusing configurable classes to represent more than one field.
# module config return [ 'graphql_fields' => [ 'query_fields' => [ 'field_classes' => 'My\\FieldClass', ], ], ];
riddlestone/brokkr-graphql 适用场景与选型建议
riddlestone/brokkr-graphql 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 11 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 riddlestone/brokkr-graphql 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 riddlestone/brokkr-graphql 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2021-11-08