PHPackages                             andi-lab/graphql-php - 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. andi-lab/graphql-php

ActiveLibrary[API Development](/categories/api)

andi-lab/graphql-php
====================

GraphQL library for PHP

1.0.1(2y ago)71.7k↓100%21MITPHPPHP ^8.1

Since Dec 11Pushed 2y ago1 watchersCompare

[ Source](https://github.com/andrey-mokhov/graphql-php)[ Packagist](https://packagist.org/packages/andi-lab/graphql-php)[ RSS](/packages/andi-lab-graphql-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (4)Used By (1)

 [![](https://github.com/andrey-mokhov/graphql-php/workflows/build/badge.svg)](https://github.com/andrey-mokhov/graphql-php/actions) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/ed00e94542a030d0ccc05413ea96bc9ec6c633cd3de6a78ae5c1bf281f7fd0b6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e647265792d6d6f6b686f762f6772617068716c2d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/andrey-mokhov/graphql-php/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/6f1b7bc1083cc9aae37bad8b0a37dfc4ae564d13ae46ae861fdd868ce719c564/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e647265792d6d6f6b686f762f6772617068716c2d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/andrey-mokhov/graphql-php/?branch=master) [![Build Status](https://camo.githubusercontent.com/38ced2d736ada9ae1e6013d6dd69195a8600a61bea97578fb81ea29b8032ce45/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e647265792d6d6f6b686f762f6772617068716c2d7068702f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/andrey-mokhov/graphql-php/build-status/master) [![Code Intelligence Status](https://camo.githubusercontent.com/dd09f28ac0cc1c4e000c128848b3878e9b8973864a4fb2bb1ce6c0835cb8e513/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e647265792d6d6f6b686f762f6772617068716c2d7068702f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence) [![Code Coverage](https://camo.githubusercontent.com/8cd2cf5e10fad1b733611630098dd5a7133f8cecb6e0bd7757b107a065a9ac8b/68747470733a2f2f73686570686572642e6465762f6769746875622f616e647265792d6d6f6b686f762f6772617068716c2d7068702f636f7665726167652e737667)](https://shepherd.dev/github/andrey-mokhov/graphql-php) [![Psalm Level](https://camo.githubusercontent.com/7421c61d6a8b8730d55ef66da642aff8b237a016189498123de179fadf20cfbe/68747470733a2f2f73686570686572642e6465762f6769746875622f616e647265792d6d6f6b686f762f6772617068716c2d7068702f6c6576656c2e737667)](https://shepherd.dev/github/andrey-mokhov/graphql-php)

GraphQL library
===============

[](#graphql-library)

The GraphQL library for PHP allows you to define a GraphQL API using attributes, interfaces, and prepared abstract classes.

Features
--------

[](#features)

Key features of the library include:

- framework agnostic, currently integrated with SpiralFramework on RoadRunner;
- support code first &amp; schema first principles, which can simultaneously complement each other;
- extending via middleware layers.

Simple Example
--------------

[](#simple-example)

```
use Andi\GraphQL\Attribute\Argument;
use Andi\GraphQL\Attribute\MutationField;
use Andi\GraphQL\Attribute\QueryField;

final class SimpleController
{
    #[QueryField(name: 'echo')]
    #[MutationField(name: 'echo')]
    public function echoMessage(#[Argument] string $message): string
    {
        return 'echo: ' . $message;
    }
}
```

This example shows how easy it is to define Query &amp; Mutation. At the same time, the library provides full control when defining a GraphQL schema: custom types, required fields, default values, and much more.

Documentation
-------------

[](#documentation)

Documentation is currently available in:

- [English](docs/en/index.md)
- [Russian](docs/ru/index.md)

Examples
--------

[](#examples)

The library [includes examples](examples) of defining a GraphQL schema. All definitions mentioned in the documentation are present in the examples in one form or another.

License
-------

[](#license)

See [LICENSE](../../../LICENSE)

Community
---------

[](#community)

Telegram group: [GraphQL library for PHP](https://t.me/andi_lab_graphql)

Roadmap
-------

[](#roadmap)

- release 1.0
    - documentation of the development of middleware layers, with an example
    - documentation and example of connecting the [`ecodev/graphql-upload`](https://github.com/Ecodev/graphql-upload) library for uploading files
    - support multiple schemas for `andi-lab/graphql-php-spiral`
- release 1.1
    - mockup types and fields
- other release
    - inputs validate
    - integration with Apollo Federation

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.3% 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 ~64 days

Total

2

Last Release

814d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/de2c856cdc8df5a82aeacfa5ad2a49abfdde8e9b46ee4aae0a966224194c12a7?d=identicon)[andrey-mokhov](/maintainers/andrey-mokhov)

---

Top Contributors

[![andrey-mokhov](https://avatars.githubusercontent.com/u/2811694?v=4)](https://github.com/andrey-mokhov "andrey-mokhov (145 commits)")[![Goderrr](https://avatars.githubusercontent.com/u/88604217?v=4)](https://github.com/Goderrr "Goderrr (1 commits)")

---

Tags

graphqlgraphql-phpandi-lab

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/andi-lab-graphql-php/health.svg)

```
[![Health](https://phpackages.com/badges/andi-lab-graphql-php/health.svg)](https://phpackages.com/packages/andi-lab-graphql-php)
```

###  Alternatives

[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k10.7M93](/packages/nuwave-lighthouse)[overblog/graphql-bundle

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

8027.9M28](/packages/overblog-graphql-bundle)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5723.1M30](/packages/thecodingmachine-graphqlite)[aimeos/ai-admin-graphql

Aimeos Admin GraphQL API extension

944100.0k4](/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

1394.2M28](/packages/mll-lab-graphql-php-scalars)[ivome/graphql-relay-php

A PHP port of GraphQL Relay reference implementation

271632.4k5](/packages/ivome-graphql-relay-php)

PHPackages © 2026

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