preprio/laravel-graphql-sdk
最新稳定版本:1.1.2
Composer 安装命令:
composer require preprio/laravel-graphql-sdk
包简介
Prepr GraphQL wrapper for Laravel
README 文档
README
This Laravel package is a provider for the Prepr GraphQL API.
How to install
Install Package
composer require preprio/laravel-graphql-sdk
Added config in you're .env file and config/services.php
config/services.php
'prepr' => [
'endpoint' => env('PREPR_ENDPOINT'),
'timeout' => env('PREPR_TIMEOUT'),
'connect_timeout' => env('PREPR_CONNECT_TIMEOUT')
]
.env
PREPR_ENDPOINT={YOUR_API_ENDPOINT}
Query the API
Option with query file (create file in app/Queries with .graphql extension):
$response = Http::prepr([
'query' => 'name-of-the-file',
'variables' => [
'id' => 123,
]
]);
Option without a query file:
$response = Http::prepr([
'raw-query' => 'query here',
'variables' => [
'id' => 123,
]
]);
Option with headers
$response = Http::prepr([
'query' => 'name-of-the-file',
'variables' => [
'id' => 123
],
'headers' => [
'Prepr-Customer-Id' => request()->get('customer_id',request()->session()->getId())
]
]);
统计信息
- 总下载量: 1.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-22