Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Graphql Client

Graphql Client Laravel Package

bendeckdavid/graphql-client

A lightweight GraphQL client for Laravel and PHP with a fluent interface for building queries and mutations, passing variables and headers, and handling responses from remote GraphQL APIs. It simplifies integrating GraphQL services into your application with clean, readable code.

View on GitHub
Deep Wiki
Context7

Graphql Client for Laravel

Frequently asked questions about Graphql Client
How do I install bendeckdavid/graphql-client in a Laravel application?
Install it with Composer using composer require bendeckdavid/graphql-client. After installation, confirm package discovery registered the service provider in your app's provider list, or verify the package's extra.laravel.providers entry. If the package publishes configuration, run the vendor:publish command and review the defaults before using the client. Installation is low ceremony and typically measured in hours, not sprints.
Does bendeckdavid/graphql-client support Laravel 11 and PHP 8.3?
The package is a Laravel/PHP client, but the provided release context does not confirm the exact Laravel and PHP version matrix. Check composer.json for explicit PHP and illuminate/support constraints and confirm whether Laravel 11 and PHP 8.3 are covered. If your application targets PHP 8.3 or Laravel 11, verify in a spike branch before adopting the package in production.
How do I build a GraphQL query or mutation with variables and headers using this client?
The package provides a fluent interface for composing GraphQL queries and mutations. You can pass variables and headers through the same fluent chain before sending the request to the remote GraphQL API. Keep the client inside a dedicated gateway or service class so the vendor API does not leak into controllers or domain code. Then add contract tests for the exact query shape, variables, and headers you rely on.
Is bendeckdavid/graphql-client safe to use in production?
It is a small-maintainer package, so treat it as a concentration risk and pin the version rather than using a wide caret constraint. The v1.3.1 release notes bundle an opt-in JSON-object response parameter with ambiguous numeric JSON handling under a patch version, which warrants verification. Pilot the client in one non-critical consumer service first and lock response shape and numeric fidelity with contract tests. Adoption is reasonable where the team consumes a GraphQL API, but not for serving GraphQL.
How do I get GraphQL responses as a JSON object in bendeckdavid/graphql-client v1.3.1?
Version 1.3.1 adds a parameter intended to return responses as a JSON object, according to the release note. The note is ambiguous, so confirm in the source or tests whether the parameter is opt-in and what default behavior remains. Do not enable it in production until you understand the return type and have contract tests comparing the legacy and new paths. Start on the legacy default path, then opt in deliberately.
What is the difference between bendeckdavid/graphql-client and Lighthouse or webonyx/graphql-php?
bendeckdavid/graphql-client is an outbound client for consuming a remote GraphQL API from Laravel or PHP. Lighthouse and webonyx/graphql-php are for serving GraphQL from your Laravel application. Use this package when your team is the GraphQL consumer, not the GraphQL server. If you need to expose a GraphQL schema, this package is not the right fit.
Does the client preserve large integer IDs in GraphQL JSON responses?
The v1.3.1 release note mentions a change to numeric handling within JSON, which raises precision concerns for large integer IDs such as snowflake or Stripe-style identifiers. The note does not clarify whether the change affects the default decode path or only the new JSON-object parameter path. Add an assertion that numeric IDs round-trip as strings, and test with values that would lose precision as floats. Treat v1.3.1 as a potential behavior change despite the patch number.
Can I test bendeckdavid/graphql-client with Laravel HTTP client fakes?
The package performs outbound GraphQL requests, but the provided context does not confirm whether it composes directly with Laravel's Http client fakes. Verify that in a small test against the package before relying on fakes in your suite. If it does not compose, introduce a seam behind an internal GraphqlGateway interface so tests can fake your gateway instead. Contract tests should still validate query shape, variables, headers, and response handling.
How do I migrate from raw Guzzle or cURL GraphQL calls to this Laravel client?
Introduce the package behind your existing internal interface instead of calling it directly from controllers or models. Port one query first, then diff the responses from the raw call and the package path byte-for-byte. Expand to mutations and other queries only after the first comparison is clean. For greenfield work, install, pin the version, and write contract tests against the upstream schema before writing feature code.
What return type does bendeckdavid/graphql-client return: array, stdClass, or Collection?
The release context does not specify the concrete return type, and v1.3.1 adds a JSON-object response path that may change it. Any downstream code using strict types will break if the type shifts between patch releases. Wrap the client behind an internal interface and normalize the response into a type your application controls. Add contract tests that lock the expected shape before upgrading.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource