laracomponents / graphql
为 Laravel 的 GraphQL & Relay
0.2.2
2017-08-22 06:19 UTC
Requires
- php: >=5.6.4
- youshido/graphql: ^1.5
Requires (Dev)
- orchestra/testbench: 3.1.*|3.2.*|3.3.*|3.4.*
- phpunit/phpunit: ~5.0|~6.0
This package is not auto-updated.
Last update: 2024-09-15 02:43:08 UTC
README
介绍
GraphQL & Relay for Laravel
要求
- PHP 5.6.4+ 或更高版本
- Laravel 5.1 或更高版本
安装
使用 composer 安装此包
composer require laracomponents/graphql
打开 config/app.php 文件,并将以下内容添加到 providers 数组中
'providers' => [ // ... LaraComponents\GraphQL\ServiceProvider::class, ],
发布配置文件
php artisan vendor:publish --provider="LaraComponents\GraphQL\ServiceProvider"
简单用法
创建一个模式
$ php artisan make:graphql:scheme DefaultSchema
创建一个类型
$ php artisan make:graphql:type UserType Which type would you like to create?: [0] AbstractType [1] AbstractScalarType [2] AbstractObjectType [3] AbstractMutationObjectType [4] AbstractInputObjectType [5] AbstractInterfaceType [6] AbstractEnumType [7] AbstractListType [8] AbstractUnionType
创建一个字段
$ php artisan make:graphql:field UsersField
文档
所有详细文档可在主要的 GraphQL 仓库中找到 – http://github.com/youshido/graphql/.
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。