arthem/graphql-mapper-bundle

GraphQL Mapper Symfony 扩展包

安装: 29

依赖者: 0

建议者: 0

安全性: 0

星标: 4

关注者: 2

分支: 1

开放问题: 0

类型:symfony-bundle

0.0.2 2016-05-20 19:46 UTC

This package is auto-updated.

Last update: 2024-08-29 03:52:51 UTC


README

Symfony 扩展包,用于 GraphQL Mapper

安装

可以通过 Composer 安装,包名为 arthem/graphql-mapper-bundle

composer require arthem/graphql-mapper-bundle

设置/配置

启用扩展包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Arthem\Bundle\GraphQLBundle\ArthemGraphQLBundle(),
        );

        // ...
    }

    // ...
}

创建您的模式

# app/config/graphql_schema.yml

# Your schema here

参阅 graphql-mapper 文档

然后在扩展包配置中声明您的映射文件

# app/config/config.yml

arthem_graphql:
    mapping:
        files:
            - %kernel.root_dir%/config/graphql_schema.yml

设置路由

# app/config/routing.yml
arthem_graphql:
    resource: "@ArthemGraphQLBundle/Resources/config/routing.yml"
    prefix:   /graphql

使用方法

只需调用 POST /app_dev.php/graphql/query 并在 body 中包含一个 "query" 即可

许可证

MIT 许可证 下发布。