PHPackages                             phonetworks/pho-lib-graphql-parser - 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. phonetworks/pho-lib-graphql-parser

ActiveLibrary[API Development](/categories/api)

phonetworks/pho-lib-graphql-parser
==================================

A general purpose GraphQL parser library in PHP

3.0(7y ago)141672[1 issues](https://github.com/phonetworks/pho-lib-graphql-parser/issues)1MITPHPPHP &gt;=5.3.0

Since Jun 4Pushed 7y ago2 watchersCompare

[ Source](https://github.com/phonetworks/pho-lib-graphql-parser)[ Packagist](https://packagist.org/packages/phonetworks/pho-lib-graphql-parser)[ Docs](https://phonetworks.org)[ RSS](/packages/phonetworks-pho-lib-graphql-parser/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (6)Versions (9)Used By (1)

pho-lib-graphql-parser
======================

[](#pho-lib-graphql-parser)

A general purpose GraphQL schema parser library in PHP. This library does **not** parse GraphQL queries or responses.

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

[](#installation)

The recommended way to install pho-lib-graphql-parser is [through composer](https://getcomposer.org/). It's as simple as:

```
composer require phonetworks/pho-lib-graphql-parser
```

Usage
-----

[](#usage)

Suppose you have the following GraphQL schema file as `BasicSchema.graphql`:

```
type Basic implements Something {
  id: ID!,
  context: String!
  user: User @the_directive(the_argument: "TheValue")
}

```

Then, you can parse it via:

```
$parsed = new Pho\Lib\GraphQL\Parser\Parse("BasicSchema.graphql");
foreach($parsed as $entity) {
  $entity_name = $entity->name(); // Basic
  $implementations = $entity->implementations(); // an array with a single element
  $implementation_name = $entity->implementations(0)->name(); // Something
  $directives = $entity->directives(); // no root level directive. But we would have one if it was type Basic @is_a { ...
  $fields = $entity->fields(); // we have three; id, context and user.
  $field_1["name"] = $entity->field(0)->name(); // id
  $field_1["type"] = $entity->field(0)->type(); // ID
  $field_1["nullable"] = $entity->field(0)->nullable(); // false (due to !)
  $field_3["directives"][0] = $entity->field(0)->directive(0)->name(); // the_directive
  $field_3["directives"][0]["arguments"][0]["name"] = $entity->field(0)->directive(0)->name(); // the_argument
  $field_3["directives"][0]["arguments"][0]["value"] = $entity->field(0)->directive(0)->value(); // TheValue
}
```

Please note, for argument values, we currently support String only.

A note on multiple inheritance
------------------------------

[](#a-note-on-multiple-inheritance)

As of version 3.0, this is a pure PHP library. However, you may want to enable C extensions in case you need "multiple inheritance" which is not currently supported in the pure PHP mode.

For multiple inheritance, the following dependencies must be met before installing pho-lib-graphql-parser. Please note, the patches shown must be applied since schema support is still experimental.

1. The [LibGraphQLParser](https://github.com/graphql/libgraphqlparser) library by Facebook. Make sure the experimental schema support is enabled with this [patch](https://github.com/graphql/libgraphqlparser/pull/49/files).
2. The [graphql-parser-php](https://github.com/dosten/graphql-parser-php) PHP extension. Make sure the experimental schema support is enabled with this [patch](https://github.com/dosten/graphql-parser-php/pull/4/commits/63d9108567a81d4777f031044dbaf65017d7a139).

To enable it in the library side, you need to set an environment variable where this program is run as follows:

`LIBGRAPHQL_ON=true`

Once you do that, you may test multiple inheritance by commenting out "return" statements in the tests/SchemaWithMultipleInheritanceTest.php file.

License
-------

[](#license)

Released under the terms of the permissive [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95% 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 ~103 days

Recently: every ~179 days

Total

8

Last Release

2591d ago

Major Versions

1.0.0 → 2.0.02017-06-09

2.1.1 → 3.02019-05-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3b6d80630289b910b490ff8998d30fd7a83e346ee6568e91c5df5eaae64d294?d=identicon)[esokullu](/maintainers/esokullu)

---

Top Contributors

[![esokullu](https://avatars.githubusercontent.com/u/19166?v=4)](https://github.com/esokullu "esokullu (19 commits)")[![groupsinc](https://avatars.githubusercontent.com/u/290835175?v=4)](https://github.com/groupsinc "groupsinc (1 commits)")

---

Tags

graphqlparsernetworkgraph

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/phonetworks-pho-lib-graphql-parser/health.svg)

```
[![Health](https://phpackages.com/badges/phonetworks-pho-lib-graphql-parser/health.svg)](https://phpackages.com/packages/phonetworks-pho-lib-graphql-parser)
```

###  Alternatives

[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k11.4M112](/packages/nuwave-lighthouse)[overblog/graphql-bundle

This bundle provides tools to build a GraphQL server in your Symfony App.

7968.2M34](/packages/overblog-graphql-bundle)[aimeos/ai-admin-graphql

Aimeos Admin GraphQL API extension

1.0k106.6k7](/packages/aimeos-ai-admin-graphql)[mll-lab/graphql-php-scalars

A collection of custom scalar types for usage with https://github.com/webonyx/graphql-php

1474.5M37](/packages/mll-lab-graphql-php-scalars)[ivome/graphql-relay-php

A PHP port of GraphQL Relay reference implementation

271671.3k5](/packages/ivome-graphql-relay-php)[overblog/graphql-php-generator

GraphQL types generator

29522.9k](/packages/overblog-graphql-php-generator)

PHPackages © 2026

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