axtiva/flexible-graphql-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

axtiva/flexible-graphql-php

最新稳定版本:v2.2.0

Composer 安装命令:

composer require axtiva/flexible-graphql-php

包简介

Schema SDL first lib for generate php code from graphql sdl to TypeRegistry with webonyx/graphql-php

README 文档

README

Schema first lib for generate php code from graphql sdl to TypeRegistry whom support webonyx/graphql-php with simple integrate to any controller.

TL;DR

Can easy to integrate graphql to any project, all you need is controller. Fast start with example

Features:

Setup

Composer install:

composer require axtiva/flexible-graphql-php 

Examples:

Demo

Up Dev server for test http Graphql requests:

php -S localhost:8080 example/start_graphql_server.php

Change schema and run example commands

Update TypeRegistry and model classes from schema and resolvers map:

php example/generate_code.php

If you need to make field resolver, then remove AutoGenerationInterface from model CodedCurrencyType

Example:

- final class CodedCurrencyType implements AutoGenerationInterface, NodeInterface, CurrencyInterface + final class CodedCurrencyType implements NodeInterface, CurrencyInterface { public string $id; - public int $code; }

and run php example/generate_code.php, after this you will find in example/Resolver/CodedCurrency/CodeResolver.php. this is your field resolver, define him in your psr container like PsrContainerExample in example/start_graphql_server.php:

$container = new PsrContainerExample([ \Axtiva\FlexibleGraphql\Example\GraphQL\Resolver\Query\AccountResolver::class => new \Axtiva\FlexibleGraphql\Example\GraphQL\Resolver\Query\AccountResolver, + \Axtiva\FlexibleGraphql\Example\GraphQL\Resolver\CodedCurrency\CodeResolver::class => + new \Axtiva\FlexibleGraphql\Example\GraphQL\Resolver\CodedCurrency\CodeResolver, ]);

Run demo app php -S localhost:8080 example/start_graphql_server.php and try request CodedCurrency.code field in query

Tests

Run tests

php vendor/bin/phpunit 

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固