PHPackages                             ruudk/graphql-client-code-generator - 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. ruudk/graphql-client-code-generator

ActiveLibrary[API Development](/categories/api)

ruudk/graphql-client-code-generator
===================================

Transform GraphQL queries into type-safe, zero-dependency PHP 8.4+ code that just works.

0.4.9(1w ago)6169.0k↓57.5%3[2 PRs](https://github.com/ruudk/graphql-client-code-generator/pulls)MITPHPPHP ^8.5CI passing

Since Aug 27Pushed 6d ago2 watchersCompare

[ Source](https://github.com/ruudk/graphql-client-code-generator)[ Packagist](https://packagist.org/packages/ruudk/graphql-client-code-generator)[ GitHub Sponsors](https://github.com/ruudk)[ RSS](/packages/ruudk-graphql-client-code-generator/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (191)Versions (64)Used By (0)

 **GraphQL Client Code Generator for PHP**
 *Transform your GraphQL queries into type-safe, zero-dependency PHP 8.4+ code. Let the generator handle types, validation, and boilerplate—you just write queries.*

 [![Latest Stable Version](https://camo.githubusercontent.com/977cbd13f5bc6c9953027db3089b7613b1c1d8d3c97b87ef369f5d6cdb20d283/68747470733a2f2f706f7365722e707567782e6f72672f727575646b2f6772617068716c2d636c69656e742d636f64652d67656e657261746f722f763f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ruudk/graphql-client-code-generator) [![PHP Version Require](https://camo.githubusercontent.com/1c3222c8f2750a79ab5f86c575a39c88f10c01a9ef919ca6d4da05e302d44cbc/68747470733a2f2f706f7365722e707567782e6f72672f727575646b2f6772617068716c2d636c69656e742d636f64652d67656e657261746f722f726571756972652f7068703f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ruudk/graphql-client-code-generator) [![Total Downloads](https://camo.githubusercontent.com/09f5f8f1c37a369f858b56cb18a85bb2c1dc74051dcd186ede930ceeb81ae69b/68747470733a2f2f706f7365722e707567782e6f72672f727575646b2f6772617068716c2d636c69656e742d636f64652d67656e657261746f722f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ruudk/graphql-client-code-generator) [![License](https://camo.githubusercontent.com/90a1797b850e636c3ed58a7e6323c53acca48054ae89ae118d41e38470a992b4/68747470733a2f2f706f7365722e707567782e6f72672f727575646b2f6772617068716c2d636c69656e742d636f64652d67656e657261746f722f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ruudk/graphql-client-code-generator)

---

Why This Library?
-----------------

[](#why-this-library)

Ever struggled with GraphQL in PHP? Tired of wrestling with nested arrays, missing autocomplete, and runtime errors from typos? Generic GraphQL clients force you to work with untyped arrays—your IDE can't help you, PHPStan can't verify anything, and every query response is a mystery until runtime.

**This library changes that.**

Write a GraphQL query, run the generator, and get beautiful, type-safe PHP classes with zero runtime dependencies. Your IDE autocompletes field names, PHPStan verifies everything at level 9, and bugs are caught during development—not production.

The Problem
-----------

[](#the-problem)

### ❌ Before: Array Hell

[](#-before-array-hell)

```
// Generic GraphQL client - no types, no safety
$data = $client->query(
