PHPackages                             kolah/php-graphql-client-generator-cli - 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. [CLI &amp; Console](/categories/cli)
4. /
5. kolah/php-graphql-client-generator-cli

ActiveProject[CLI &amp; Console](/categories/cli)

kolah/php-graphql-client-generator-cli
======================================

CLI for PHP GraphQL client generator library

v1.0.2(7y ago)217MITPHP

Since Sep 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/kolah/php-graphql-client-generator-cli)[ Packagist](https://packagist.org/packages/kolah/php-graphql-client-generator-cli)[ RSS](/packages/kolah-php-graphql-client-generator-cli/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

php-graphql-client-generator-cli
================================

[](#php-graphql-client-generator-cli)

What is this?
-------------

[](#what-is-this)

This is CLI for [PHP GraphQL client generator](https://github.com/kolah/php-graphql-client-generator), which generates a strongly typed PHP GraphQL client out of the GraphQL schema file.

At the time of creating this tool there was no decent way to utilize GraphQL APIs from PHP.

This tool is based on [camuthig/php-graphql-client-generator](https://github.com/camuthig/php-graphql-client-generator)

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

[](#requirements)

- PHP 7.1

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

[](#installation)

#### PHAR (recommended)

[](#phar-recommended)

To run installer and download PHAR with its signature file to current directory:

`curl -LSs https://kolah.github.io/php-graphql-client-generator-cli/installer.php | php`

> NOTE: If you want to rename command in order to get rid of `.phar` extension or move the tool to other directory, please note that PHAR binary is signed and requires `.pubkey` file to work, so you will need to rename signature file accordingly, fe. `mv gql2php.phar gql2php && mv gql2php.phar.pubkey gql2php.pubkey`

#### Composer (globally)

[](#composer-globally)

`composer global require kolah/php-graphql-client-generator-cli`

Usage
-----

[](#usage)

### Client generation

[](#client-generation)

In order to generate client, use `gql2php generate`. The `generate` command expects some required parameters:

- `-s` or `--schema`: path to GraphQL schema file, fe.: `./schema.graphqls`
- `-ns` or `--namespace`: a namespace to put generated code, fe. `"Kolah\Client"`
- `-o` or `--output-dir`: base directory for outputting generated code, fe. `src/Kolah/Client`

`gql2php` provides ability to override generated code by providing a map for GraphQL types to Fully Qualified Class Name:

- `-m` or `--map` "Time:Kolah\\Client\\Extended\\Time"

In order to use generated code, the base client is required as a dependency:

`composer require kolah/php-graphql-client-base`

### Self-update (PHAR version)

[](#self-update-phar-version)

This application provides self-update mechanism. To check for updates and automatically update the tool, use `gql2php update`. In case of finding a newer version, the old one is backed up.

You can rollback to the previous version, if there is one stored using `gql2php update --rollback`.

> NOTE: For composer global install, use `composer global update kolah/php-graphql-client-generator-cli`

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~15 days

Total

3

Last Release

2784d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60c8561ced4d92011d61927144e45dad1e5cd3ec163374823a123f1cb991b706?d=identicon)[kolah](/maintainers/kolah)

---

Top Contributors

[![kolah](https://avatars.githubusercontent.com/u/448553?v=4)](https://github.com/kolah "kolah (17 commits)")

### Embed Badge

![Health badge](/badges/kolah-php-graphql-client-generator-cli/health.svg)

```
[![Health](https://phpackages.com/badges/kolah-php-graphql-client-generator-cli/health.svg)](https://phpackages.com/packages/kolah-php-graphql-client-generator-cli)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[crazywhalecc/static-php-cli

Build single static PHP binary, with PHP project together, with popular extensions included.

1.8k13.9k](/packages/crazywhalecc-static-php-cli)[matthiasnoback/symfony-console-form

Use Symfony forms for Console command input

368264.8k8](/packages/matthiasnoback-symfony-console-form)[platformsh/cli

Platform.sh CLI

23238.0k](/packages/platformsh-cli)[shel/neos-terminal

Neos CMS Ui terminal for running Eel expressions and other commands

1441.3k](/packages/shel-neos-terminal)

PHPackages © 2026

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