PHPackages                             raphaelcangucu/gql-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. [API Development](/categories/api)
4. /
5. raphaelcangucu/gql-client

ActiveLibrary[API Development](/categories/api)

raphaelcangucu/gql-client
=========================

Graphql Client for Laravel

0.2.3(10mo ago)015.9k↓13.1%ISCPHPPHP ^8.0

Since Aug 28Pushed 10mo agoCompare

[ Source](https://github.com/raphaelcangucu/gql-client)[ Packagist](https://packagist.org/packages/raphaelcangucu/gql-client)[ Docs](https://github.com/bendeckdavid/graphql-laravel-client#readme)[ RSS](/packages/raphaelcangucu-gql-client/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (5)Versions (7)Used By (0)

GraphQL Laravel Client
======================

[](#graphql-laravel-client)

A minimal GraphQL client for Laravel applications. This package is a continuation of the original work by David Gutierrez (BendeckDavid), who has discontinued this project. We've updated it with the latest dependencies, comprehensive testing, and continued maintenance under the new namespace.

Credits
-------

[](#credits)

**Original Author:** David Gutierrez [@bendeckdavid](https://www.github.com/bendeckdavid)

This package is based on the original `bendeckdavid/graphql-client` package. All core functionality and design patterns are credited to the original author. This fork continues development with bug fixes, updates, and improvements.

Requirements
------------

[](#requirements)

- PHP ^8.0
- Laravel ^8.0|^9.0|^10.0|^11.0|^12.0
- Composer 2+

Installation
------------

[](#installation)

Install Package (Composer 2+)

```
composer require raphaelcangucu/gql-client
```

Usage
-----

[](#usage)

Enviroment variable

```
GRAPHQL_ENDPOINT="https://api.spacex.land/graphql/"
```

Authentication
--------------

[](#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.

```
GRAPHQL_CREDENTIALS="YOUR_CREDENTIALS"
```

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.

```
GRAPHQL_AUTHENTICATION_HEADER="Authorization"

// Allowed: basic, bearer, custom
GRAPHQL_AUTHENTICATION="bearer"
```

Usage/Examples
--------------

[](#usageexamples)

Import GraphQL Client Facades

```
use RaphaelCangucu\GqlClient\Facades\GraphQL;
```

Basic use

```
return GraphQL::query('
    capsules {
        id
        original_launch
        status
        missions {
            name
            flight
        }
    }
')->get();
//->get('json'); //get response as json object
```

Mutation request:

```
return GraphQL::mutation('
    insert_user(name: "David") {
        id
        name
        date_added
    }
')->get();
//->get('json');
```

You can access "query" or "mutation" as a shortcut if you are not passing variables, if is not the case you must use the "raw" attribute:

```
return GraphQL::raw('
    mutation($name: String) {
        insert_user(name: $name) {
            id
            name
            date_added
        }
    }
')
->with(["name" => "David"])
->get();
//->get('json');
```

The `variables` or `payload` to the GraphQL request can also be passed using magic methods like:

```
return GraphQL::raw('
    mutation($name: String) {
        insert_user(name: $name) {
            id
            name
            date_added
        }
    }
')
->withName("David")
->get();
//->get('json');
```

If you want to address te request to another endpoint, you can do :

```
return GraphQL::endpoint("https://api.spacex.land/graphql/")
->query('
    capsules {
        id
        original_launch
        status
        missions {
            name
            flight
        }
    }
')->get();
//->get('json');
```

Headers
-------

[](#headers)

You can include a header to the request by using the attribute "header" or add multiple headers by "withHeaders":

```
return GraphQL::query($query)
->header('name', 'value')
->withHeaders([
    'name' => 'value',
    'name' => 'value'
])->get();
```

Context
-------

[](#context)

Add additional context to the request

```
return GraphQL::query($query)
->context([
    'ssl' => [
         "verify_peer" => false,
         "verify_peer_name" => false,
    ]
  ])->get();
```

Testing
-------

[](#testing)

This package comes with comprehensive test coverage. Run tests using:

```
composer test
```

For coverage reports:

```
composer test-coverage
```

Configuration Publishing
------------------------

[](#configuration-publishing)

Publish the configuration file to customize authentication and endpoint settings:

```
php artisan vendor:publish --provider="RaphaelCangucu\GqlClient\GraphqlClientServiceProvider" --tag="config"
```

What's New in This Fork
-----------------------

[](#whats-new-in-this-fork)

- Updated to support PHP 8.0+ and Laravel 8-12
- Laravel 12 compatibility added in version 0.2.0
- Comprehensive test suite with 40+ tests
- Updated dependencies and security improvements
- Fixed deprecated method names (`mutator` → `mutation`)
- Improved error handling and documentation
- Full namespace migration for modern Laravel applications

Original Author &amp; Contributors
----------------------------------

[](#original-author--contributors)

**Original Author:** David Gutierrez [@bendeckdavid](https://www.github.com/bendeckdavid)

**Original Top Contributors:**

- Ehsan Quddusi [@ehsanquddusi](https://github.com/ehsanquddusi)

**Original Contributors:**

- Ryan Mayberry [@kerkness](https://github.com/kerkness)
- Jamie Duong [@chiendv](https://github.com/chiendv)

Current Maintainer
------------------

[](#current-maintainer)

- Raphael Cangucu [@raphaelcangucu](https://github.com/raphaelcangucu)

License
-------

[](#license)

This project maintains the same license as the original package.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance54

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

6

Last Release

309d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/475c93b20e68d9c282c8a8f2aeac74f936cc79d53a27bb654a3e689506013a42?d=identicon)[raphaelcangucu](/maintainers/raphaelcangucu)

---

Top Contributors

[![bendeckdavid](https://avatars.githubusercontent.com/u/10557517?v=4)](https://github.com/bendeckdavid "bendeckdavid (20 commits)")[![ehsanquddusi](https://avatars.githubusercontent.com/u/186699?v=4)](https://github.com/ehsanquddusi "ehsanquddusi (5 commits)")[![raphaelcangucu](https://avatars.githubusercontent.com/u/5266252?v=4)](https://github.com/raphaelcangucu "raphaelcangucu (4 commits)")[![chiendv](https://avatars.githubusercontent.com/u/468522?v=4)](https://github.com/chiendv "chiendv (3 commits)")[![kerkness](https://avatars.githubusercontent.com/u/95617?v=4)](https://github.com/kerkness "kerkness (3 commits)")

---

Tags

laravelgraphqlGraphql ClientBendeckDavid

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/raphaelcangucu-gql-client/health.svg)

```
[![Health](https://phpackages.com/badges/raphaelcangucu-gql-client/health.svg)](https://phpackages.com/packages/raphaelcangucu-gql-client)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k11.8M117](/packages/nuwave-lighthouse)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
