PHPackages                             0length/graphql-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. 0length/graphql-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

0length/graphql-client
======================

The good and minimal Graphql Http client for Laravel.

v2.0.1.8-stable(2y ago)143MITPHP

Since Oct 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/0length/graphql-client)[ Packagist](https://packagist.org/packages/0length/graphql-client)[ RSS](/packages/0length-graphql-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (8)Used By (0)

Graphql-Client is a graphql client package for Laravel that you can use to consume Graphql API.

How to use
----------

[](#how-to-use)

This package is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file:

```
{
    "require": {
        "0length/graphql-client": "^2.0"
    }
}
```

and run composer to update the dependencies `composer update`.

Then open your Laravel config file config/app.php and in the `$providers` array add the service provider for this package.

```
\Zerolength\Graphql\GraphqlServiceProvider::class
```

Generate the configuration file running in the console:

```
php artisan vendor:publish --tag=config

```

Finally add your graphql server endpoint url and headers option as following example below:

```
GRAPHQL_WORKSPACE="http://127.0.0.1:4001/graphql"
GRAPHQL_HEADERS="Authorization: App keyxxx,Header2: value"

```

Example Query Class Creation
----------------------------

[](#example-query-class-creation)

```
