andi-lab/graphql-php
最新稳定版本:1.0.1
Composer 安装命令:
composer require andi-lab/graphql-php
包简介
GraphQL library for PHP
README 文档
README
GraphQL library
The GraphQL library for PHP allows you to define a GraphQL API using attributes, interfaces, and prepared abstract classes.
Features
Key features of the library include:
- framework agnostic, currently integrated with SpiralFramework on RoadRunner;
- support code first & schema first principles, which can simultaneously complement each other;
- extending via middleware layers.
Simple Example
use Andi\GraphQL\Attribute\Argument; use Andi\GraphQL\Attribute\MutationField; use Andi\GraphQL\Attribute\QueryField; final class SimpleController { #[QueryField(name: 'echo')] #[MutationField(name: 'echo')] public function echoMessage(#[Argument] string $message): string { return 'echo: ' . $message; } }
This example shows how easy it is to define Query & Mutation. At the same time, the library provides full control when defining a GraphQL schema: custom types, required fields, default values, and much more.
Documentation
Documentation is currently available in:
Examples
The library includes examples of defining a GraphQL schema. All definitions mentioned in the documentation are present in the examples in one form or another.
License
See LICENSE
Community
Telegram group: GraphQL library for PHP
Roadmap
- release 1.0
- documentation of the development of middleware layers, with an example
- documentation and example of connecting the
ecodev/graphql-uploadlibrary for uploading files - support multiple schemas for
andi-lab/graphql-php-spiral
- release 1.1
- mockup types and fields
- other release
- inputs validate
- integration with Apollo Federation
统计信息
- 总下载量: 1.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-11