定制 overblog/graphql-php-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

overblog/graphql-php-generator

最新稳定版本:v0.12.6

Composer 安装命令:

composer require overblog/graphql-php-generator

包简介

GraphQL types generator

README 文档

README

GraphQL PHP types generator...

Code Coverage Build Status

Installation

composer require overblog/graphql-php-generator

Usage

<?php $loader = require __DIR__.'/vendor/autoload.php'; use GraphQL\Schema; use Overblog\GraphQLGenerator\Generator\TypeGenerator; use Symfony\Component\ExpressionLanguage\Expression; $configs = [ 'Character' => [ 'type' => 'interface', 'config' => [ 'description' => new Expression('\'A character\' ~ \' in the Star Wars Trilogy\''), 'fields' => [ 'id' => ['type' => 'String!', 'description' => 'The id of the character.'], 'name' => ['type' => 'String', 'description' => 'The name of the character.'], 'friends' => ['type' => '[Character]', 'description' => 'The friends of the character.'], 'appearsIn' => ['type' => '[Episode]', 'description' => 'Which movies they appear in.'], ], 'resolveType' => 'Overblog\\GraphQLGenerator\\Tests\\Resolver::resolveType', ], ], /*...*/ 'Query' => [ 'type' => 'object', 'config' => [ 'description' => 'A humanoid creature in the Star Wars universe or a faction in the Star Wars saga.', 'fields' => [ 'hero' => [ 'type' => 'Character', 'args' => [ 'episode' => [ 'type' => 'Episode', 'description' => 'If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.', ], ], 'resolve' => ['Overblog\\GraphQLGenerator\\Tests\\Resolver', 'getHero'], ], ], ], /*...*/ ], ]; $typeGenerator = new TypeGenerator('\\My\\Schema\\NP'); $classesMap = $typeGenerator->generateClasses($configs, __DIR__ . '/cache/types'); $loader->addClassMap($classesMap); $schema = new Schema(\My\Schema\NP\QueryType::getInstance());

统计信息

  • 总下载量: 515.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 31
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 29
  • Watchers: 10
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固