thecodingmachine/graphqlite-misc-types
Composer 安装命令:
composer require thecodingmachine/graphqlite-misc-types
包简介
A collection of non-standard GraphQL types to be used with GraphQLite.
关键字:
README 文档
README
GraphQLite miscellaneous types
This package is an add-on to the GraphQLite PHP library. It contains a set of GraphQL scalar types that can be added to GraphQLite.
Install
$ composer require thecodingmachine/graphqlite-misc-types
"Any" scalar type
This types adds support for a "AnyScalar" type that can be any of "string", "int", "float" or "bool".
Usage
/** * @Query() * @param scalar $scalar * @return scalar */ public function echoScalar($scalar) { return $scalar; }
Use the "scalar" type-hint in the DocBlock to cast a value to "AnyScalar".
Registering AnyScalar
Using the SchemaFactory
If you are using the SchemaFactory to initialize GraphQLite, use this code to add support for AnyScalar:
$schemaFactory->addRootTypeMapper(new \TheCodingMachine\GraphQLite\Types\AnyScalar\AnyScalarTypeMapper());
Using the Symfony bundle
If you are using the Symfony bundle to initialize GraphQLite, register the AnyScalarTypeMapper as a service:
# config/services.yaml services: TheCodingMachine\GraphQLite\Types\AnyScalar\AnyScalarTypeMapper: tags: ['graphql.root_type_mapper']
统计信息
- 总下载量: 5.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-03