知海

PHP:GraphQLite(服务端)

graphql-github-io-zh-Hans生态项目与库

PHP:GraphQLite(服务端)

属性
名称 GraphQLite
描述 GraphQLite 是一个为 GraphQL schema 定义提供基于注解语法的库。
官网 https://graphqlite.thecodingmachine.io
GitHub thecodingmachine/graphqlite

它不依赖于特定框架,并提供了可用于 Symfony 和 Laravel 的绑定。

以下代码声明了一个 "product" 查询和一个 "Product" 类型:

php 复制代码
class ProductController
{
    /**
     * @Query()
     */
    public function product(string $id): Product
    {
        // Some code that looks for a product and returns it.
    }
}

/**
 * @Type()
 */
class Product
{
    /**
     * @Field()
     */
    public function getName(): string
    {
        return $this->name;
    }
    // ...
}

GraphQLite 的其他功能包括校验、安全、错误处理、通过 data-loader 模式加载等……

帮助我们改进文档

发现翻译问题或内容错误?请告诉我们。