axtiva / flexible-graphql-bundle

以 Schema 为首的包,用于从 GraphQL SDL 生成 PHP 代码,并将其添加到 TypeRegistry 中,适用于 symfony 框架的 webonyx/graphql-php

v2.2.0 2024-05-28 20:29 UTC

This package is auto-updated.

Last update: 2024-08-28 21:05:33 UTC


README

Symfony 扩展包,用于 Flexible Graphql PHP,以快速实现 GraphQL API

特性

  • 以 SDL 为首的代码生成
  • 快速集成到任何项目中,无需打破更改
  • 在 Schema 定义上实现惰性加载
  • Apollo Federation 支持
  • 可执行指令
  • 支持 symfony 原生 opcache 预加载文件生成

设置

Composer 安装

composer require axtiva/flexible-graphql-bundle

创建包配置

# content of config/packages/flexible_graphql.yaml
flexible_graphql:
  namespace: App\GraphQL # namespace where store GraphQL models and resolvers
  dir: '%kernel.project_dir%/src/GraphQL/' # path where it will be they save files
  schema_type: graphql # type of schema generation. Default is `graphql` or optional is `federation` for apollo federation support 
  schema_files: '%kernel.project_dir%/config/graphql/*.graphql' # path to graphql schema SDL files
  enable_preload: false # use Symfony preload if it true
  default_resolver: flexible_graphql.default_resolver # default resolver if it does not defined

运行命令

bin/console cache:clear

查看 flexible_graphql.dir 创建的文件。

快速安装

快速安装 指南

示例集成

查看示例项目 axtiva/example-integration/FlexibleGraphqlBundle

支持的命令

bin/console list flexible_graphql