https://github.com/preprio/laravel-graphql-sdk
This Laravel package is a provider for the Prepr GraphQL API.
https://github.com/preprio/laravel-graphql-sdk
laravel laravel-macros
Last synced: 3 months ago
JSON representation
This Laravel package is a provider for the Prepr GraphQL API.
- Host: GitHub
- URL: https://github.com/preprio/laravel-graphql-sdk
- Owner: preprio
- Created: 2023-05-22T10:52:41.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-30T11:32:09.000Z (over 1 year ago)
- Last Synced: 2025-02-25T08:48:47.038Z (3 months ago)
- Topics: laravel, laravel-macros
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel GraphQL SDK
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())
]
]);
```