graphql-php (Craft fork)

Craft CMS's maintained fork of webonyx/graphql-php, a PHP port of the GraphQL reference implementation.

Library
Composer
vv14.11.10.1
0stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
14/100Needs Attention
Development Activity12
Maintenance0
Community24
Maturity20
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture89
Code Quality88
Innovation78
Learning Curve68

graphql-php (pixelandtonic/graphql-php) is Pixel & Tonic’s maintained fork of the popular webonyx/graphql-php library, a feature-complete PHP implementation of the GraphQL specification based on the JavaScript reference implementation. The fork exists so Craft CMS can pin and patch specific behavior while staying compatible with the upstream 14.x line.

Like upstream, it provides everything needed to build a GraphQL server in PHP: a type system for defining schemas, a query parser and validator, an executor with deferred/promise support for solving N+1 problems, and a standard HTTP server helper. It is the GraphQL engine that powers Craft CMS’s GraphQL API.

What You Get

  • A complete GraphQL type system for defining schemas in PHP
  • A spec-compliant query parser, validator, and executor
  • Deferred resolution and promise adapters to avoid N+1 queries
  • A standard HTTP server helper for handling GraphQL requests
  • Compatibility with the upstream webonyx 14.x API and documentation

Common Use Cases

  • Powering the GraphQL API layer of a Craft CMS installation
  • Building a custom GraphQL server in a PHP application
  • Defining strongly typed schemas with resolvers in PHP
  • Pinning a patched GraphQL implementation for a specific project

Under The Hood

Architecture - The library mirrors the GraphQL reference implementation’s layering under the GraphQL namespace: Language (lexer, parser, AST), Type (the schema type system), Validator (rule-based query validation), Executor (field resolution with Deferred support), Server (HTTP request handling), and Utils (schema printing, introspection, AST helpers). A schema built from Type definitions is validated and executed against incoming query documents parsed by the Language layer.

Tech Stack - Pure PHP supporting PHP 7.1+ and 8, requiring ext-json and ext-mbstring. Optional promise adapters integrate react/promise and amphp/amp for asynchronous deferred resolution, and nyholm/psr7 plus psr/http-message enable PSR-7 server handling. Tooling includes PHPUnit, PHPBench, and PHPStan with strict rules.

Code Quality - As a fork of a mature, heavily tested upstream (over 1,300 commits of history), the code carries an extensive test suite, benchmarks, and a PHPStan baseline. This fork’s own repository shows little independent activity because its purpose is to track and patch upstream rather than diverge, so most quality signals derive from webonyx/graphql-php.

API Design - The API follows the JS reference closely, which makes it familiar to anyone who knows graphql-js: types are defined declaratively, resolvers are closures on fields, and GraphQL::executeQuery drives execution. There is meaningful upfront learning to model a schema, but the StandardServer and thorough upstream documentation reduce boilerplate for common HTTP setups.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search