liinkiing/graphql-maker-bundle

用于轻松为 Overblog GraphQLBundle 创建 GraphQL 类型的捆绑包

安装次数: 3,689

依赖项: 0

推荐者: 0

安全: 0

星标: 10

关注者: 4

分支: 0

公开问题: 0

类型:symfony-bundle

1.3.0 2020-04-27 14:13 UTC

This package is auto-updated.

Last update: 2024-09-27 23:39:00 UTC


README

通过使用新的 Symfony Maker 组件,为 Overblog GraphQL Bundle 创建 GraphQL 类型,这是一个易于使用的捆绑包

安装

$ composer require liinkiing/graphql-maker-bundle

如果你使用 Symfony flex,它将自动在 bundles.php 文件中注册。否则,请手动注册捆绑包

// AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Liinkiing\GraphQLMakerBundle\GraphQLMakerBundle(),
        ];

        // ...
    }
}

配置

默认情况下,无需配置。它使用 约定优于配置,但如果你想要自定义行为,可以添加配置文件 config/packages/dev/graphql_maker.yaml

graphql_maker:
  root_namespace: App\GraphQL # Customize the root namespace where PHP mutations and resolver will be
  schemas: # You can also define, for any schemas if you use many, a custom out directory for types files
    public:
      out_dir: '%kernel.project_dir%/config/graphql/public/types'
    internal:
      out_dir: '%kernel.project_dir%/config/graphql/internal/types'
    preview:
      out_dir: '%kernel.project_dir%/config/graphql/preview/types'

使用方法

目前,你可以生成

  • 类型
  • 连接
  • 查询
  • 突变
$ bin/console make:graphql:type       [--schema]
$ bin/console make:graphql:connection [--schema]
$ bin/console make:graphql:query      [--schema]
$ bin/console make:graphql:mutation   [--schema]
$ bin/console make:graphql:resolver

然后,你将需要回答一些问题来生成你请求的内容,就像 à la Maker