mindgram/graphql-federation
Composer 安装命令:
composer require mindgram/graphql-federation
包简介
Utility for creating GraphQL microservices, which can be combined into a single endpoint through tools like Apollo Gateway
README 文档
README
Utility for creating GraphQL microservices, which can be combined into a single endpoint through tools like Apollo Gateway.
Installation
Use the package manager composer to install graphql-federation.
composer require pascaldevink/graphql-federation
Usage
Assuming you already have an existing GraphQL implementation using webonyx/graphql-php, these commands add federation:
# First, build your existing schema $existingSchema = BuildSchema::build(file_get_contents(__DIR__ . '/schema.graphqls')); # Then, extend it with Federation $federation = new \PascalDeVink\GraphQLFederation\Federation(); $schema = $federation->extendSchema($existingSchema); # Build your root value resolver $rootValue = include __DIR__ . '/rootvalue.php'; # And extend it with Federation resolvers $rootValue = $federation->addResolversToRootValue($rootValue); # Finally, execute the query GraphQL::executeQuery($schema, $query, $rootValue, null, $variableValues);
See the example of webonyx/graphql-php for the rest of the code to make it work.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
统计信息
- 总下载量: 3.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-11-18