alexaandrov/laravel-graphql-client 问题修复 & 功能扩展

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

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

alexaandrov/laravel-graphql-client

Composer 安装命令:

composer require alexaandrov/laravel-graphql-client

包简介

GraphQL client for laravel/lumen

README 文档

README

Wrapper over euautomation/graphql-client library for laravel/lumen.

Installation

You can install the package via composer:

composer require alexaandrov/laravel-graphql-client

Set endpoint url in your .env

GRAPHQL_ENDPOINT_URL=https://your-endpoint.url

For laravel:

php artisan vendor:publish --provider="Alexaandrov\GraphQL\GraphQLClientServiceProvider" 

For lumen:

Copy and setting up config:

cp vendor/alexaandrov/laravel-graphql-client/config/config.php config/graphql-client.php

Add to bootstrap/app.php

$app->configure('graphql-client');
$app->register(Alexaandrov\GraphQL\GraphQLClientServiceProvider::class);

Usage

Code

<?php

$guery = <<<QUERY
query {
    users {
        id
        email
    }
}
QUERY;

$mutation = <<<MUTATION
mutation {
    login(data: {
        username: "user@mail.com"
        password: "qwerty"
    }) {
        access_token
        refresh_token
        expires_in
        token_type
    }
}
MUTATION;

$queryResponse = Alexaandrov\GraphQL\Facades\Client::fetch($query);
foreach ($queryResponse->users as $user) {
    // Do something with the data
    $user->id;
    $user->email;
}

$mutationResponse = Alexaandrov\GraphQL\Facades\Client::fetch($mutation);

// Do something with the data
$login = $mutationResponse->login;
$login->access_token;
$login->...;

统计信息

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

GitHub 信息

  • Stars: 12
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固