Download the PHP package bendeckdavid/graphql-client without Composer
On this page you can find all versions of the php package bendeckdavid/graphql-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bendeckdavid/graphql-client
More information about bendeckdavid/graphql-client
Files in bendeckdavid/graphql-client
Package graphql-client
Short Description Graphql Client for Laravel
License ISC
Homepage https://github.com/bendeckdavid/graphql-laravel-client#readme
Informations about the package graphql-client
Minimal GraphQL Laravel Client
Minimal GraphQL client for Laravel.
Requirements
- Composer 2+
Installation
Install Package (Composer 2+)
Usage
Enviroment variable
Authentication
We provide a minimal authentication integration by appending the Authorization
header to the request client. You can pass the credentials using an env
variable.
You can also pass auth credentials at runtime using withToken($credentials)
method.
'Authorization' header and 'Bearer' Schema are used by default. You can override the default behaviour by defining following variables in your .env
file.
Usage/Examples
Import GraphQL Client Facades
Basic use
Mutator Request
You can access "query" or "mutator" as a shortcut if you are not passing variables, if is not the case you must use the "raw" attribute:
The variables
or payload
to the GraphQL request can also be passed using magic methods like:
Raw Response
You can get the raw response from the GraphQL request by using getRaw()
method instead of get()
in the request.
If you want to address the request to another endpoint, you can do :
Headers
You can include a header to the request by using the attribute "header" or add multiple headers by "withHeaders":
Context
Add additional context to the request
Author
- David Gutierrez @bendeckdavid
Top Contributors ⭐
- Ehsan Quddusi @ehsanquddusi