webonyx/graphql-php
72.0
Strong · 17 November 2026
29.4k
lines of production code
PHP
primary language
5
measurements over time
What this system is
Features
AMPHP v3 example with fiber-based async execution
Added a new example in examples/04-async-php/amphp-v3 demonstrating GraphQL execution using AMPHP v3. The example introduces AmpFutureAdapter to replace the previous AmpPromiseAdapter, requiring resolvers to return Amp\\Future instead of Amp\\Promise. It includes a fiber-based event-loop example (graphql.php) and an HTTP server example (http-server/graphql.php) that utilize Amp\\async for non-blocking resolver execution.
examples/04-async-php/amphp-v3 · high confidence
Add Hello World example with SchemaConfig usage
A new single-file example demonstrating core GraphQL concepts is now available in examples/00-hello-world. It includes a README with instructions to run a local test server and try queries and mutations, as well as a graphql.php file that implements a simple schema using the SchemaConfig object for configuration, supporting both echo queries and sum mutations.
examples/00-hello-world · high confidence
Add ReactPHP async HTTP server example
A new example demonstrating how to run a GraphQL server asynchronously using ReactPHP has been added to the examples directory. This includes a README with setup instructions and a \graphql.php\ script that implements a basic HTTP server using \react/http\ and \react/promise\, featuring a query with an async resolver and a simple mutation.
examples/04-async-php/reactphp · high confidence
Add Schema Definition Language example with query and mutation support
A new example demonstrating the Schema Definition Language has been added, showing how to define a schema with both a query (echo) and a mutation (sum) and wire them up as plain functions. Users can now run a local test server and execute both query and mutation requests against this example.
examples/02-schema-definition-language · high confidence
Add standard server example using SchemaConfig
A new example demonstrating the Standard HTTP Server has been added to the examples directory. This example shows how to configure a GraphQL schema using the SchemaConfig object and run a local test server on port 8080 that supports both query and mutation operations.
examples/03-standard-server · high confidence
Added AMPHP async examples for PHP GraphQL
New examples demonstrating how to integrate AMPHP with PHP GraphQL have been added to the documentation. These include an event-loop example that combines async execution with traditional request models (like Apache or PHP-FPM) and a standalone HTTP server example using the amphp/http-server library. Both examples utilize the AmpPromiseAdapter to handle asynchronous resolvers, allowing users to fetch data from microservices or other sources without blocking the main thread.
examples/04-async-php/amphp · high confidence
Added PHPBench performance benchmarks
Added a new \benchmarks/\ directory containing PHPBench suites to establish performance baselines for future optimizations. The suite includes benchmarks for schema building (\BuildSchemaBench\, \HugeSchemaBench\), deferred execution (\DeferredBench\), lexical analysis (\LexerBench\), validation (\OverlappingFieldsCanBeMergedBench\), scalar overrides (\ScalarOverrideBench\), and AST visitor patterns (\VisitorBench\). It also provides utility scripts (\convert-results.php\, \shim.php\) to run these benchmarks and convert the results for GitHub Actions tracking.
benchmarks · high confidence
Added benchmark utilities for generating test schemas and queries
Added two new utility classes, \QueryGenerator\ and \SchemaGenerator\, to the \benchmarks/Utils\ directory to support performance testing. \SchemaGenerator\ constructs complex GraphQL schemas with configurable nesting levels, field counts, and argument types (including enums and input objects), while \QueryGenerator\ builds corresponding query strings targeting a specific percentage of leaf fields within a given schema.
benchmarks/Utils · high confidence
Introduce dedicated Introspection and TypeKind classes with configurable introspection query options
The \src/Type\ area now includes a new \Introspection\ class that centralizes the introspection query generation and defines constants for introspection type names (e.g., \\_\Schema\, \\\_Type\). This class exposes an \getIntrospectionQuery()\ method that accepts options to conditionally include fields such as \descriptions\, \directiveIsRepeatable\, \schemaDescription\, \specifiedByURL\, and \typeIsOneOf\ in the returned query string. Additionally, a new \TypeKind\ class has been added to define constants for all GraphQL type kinds (e.g., \SCALAR\, \OBJECT\, \INTERFACE\), supporting the introspection system's type identification.
src/Type · high confidence
Introduces generic promise adapter interface and wrapper
The library now supports generic promises through a new \PromiseAdapter\ interface and a \Promise\ wrapper class. This allows the executor to integrate with various async PHP platforms (such as ReactPHP or AMPHP) by delegating promise logic to a specific adapter, making the core executor platform-agnostic while maintaining compatibility with existing promise-based workflows.
src/Executor/Promise · high confidence
New StandardServer and Helper classes for PSR-7 and HTTP request handling
The src/Server location introduces a new StandardServer class and a Helper utility class to provide a modern, PSR-7 compatible entry point for GraphQL execution. StandardServer replaces the legacy server implementation, offering methods like executePsrRequest and processPsrRequest to handle PSR-7 requests, while also supporting traditional PHP global-based HTTP parsing via Helper. The Helper class manages the parsing of HTTP requests (including JSON, form-urlencoded, and multipart/form-data bodies), validates operation parameters, and executes operations or batches. Additionally, a set of specific exception classes (e.g., BatchedQueriesAreNotSupported, CannotParseJsonBody) has been added to provide granular error reporting for request processing issues.
src/Server · high confidence
New blog example with modern PHP practices and lazy type resolution
The blog example has been rewritten to demonstrate modern PHP best practices, including strict typing, native return type hints, and PHPStan level 7 compliance. It introduces a new \AppContext\ class to pass data to resolvers, a \TypeRegistry\ for lazy-loading GraphQL types to avoid circular dependencies, and a \DataSource\ class for in-memory data management. The example also showcases custom scalar types (\EmailType\, \UrlType\), an \HtmlField\ helper for content formatting, and a \NodeType\ interface for unified object resolution.
examples/01-blog/Blog · high confidence
New example demonstrating type config decoration with SDL
Added a new example in examples/05-type-config-decorator that shows how to use the schema definition language (SDL) combined with a type config decorator to resolve object types in a GraphQL query. The example includes a PHP script (graphql.php) that builds a schema from schema.graphql using BuildSchema and a $typeConfigDecorator to inject custom resolve logic for Query.tracksForHome and Track.author fields, backed by simple model classes (Author, Track) that fetch data from a REST API.
examples/05-type-config-decorator · high confidence
New promise adapters for Amp and React, plus a synchronous promise implementation
The library now includes three new promise adapters in the Executor/Promise/Adapter directory: AmpFutureAdapter and AmpPromiseAdapter for integrating with the AmpPHP library (supporting both v3 fiber-based futures and standard promises), and ReactPromiseAdapter for integrating with ReactPHP's promise library. Additionally, a new synchronous execution model is introduced via SyncPromise, SyncPromiseAdapter, and SyncPromiseQueue, allowing GraphQL execution to proceed synchronously in environments where async promises are not available or desired, with the SyncPromiseAdapter now serving as the default adapter for the Executor.
src/Executor/Promise/Adapter · high confidence
New schema utilities: BuildSchema, BuildClientSchema, SchemaExtender, and BreakingChangesFinder
The \src/Utils\ directory now includes dedicated classes for schema construction and introspection. \BuildSchema\ allows building a schema from SDL strings or AST nodes, while \BuildClientSchema\ constructs a schema from introspection query results for client-side use. \SchemaExtender\ enables extending existing schemas with new type definitions and extensions, and \BreakingChangesFinder\ provides utilities to detect breaking and dangerous changes between two schema versions. These utilities centralize schema building logic and improve the developer experience when working with schema definitions and migrations.
src/Utils · high confidence
New type definition classes and interfaces for GraphQL schema construction
This change introduces a comprehensive set of new classes and interfaces in \src/Type/Definition\ that form the core of the GraphQL type system. It adds definition classes for all standard scalar types (\BooleanType\, \FloatType\, \IntType\, \IDType\, \CustomScalarType\), as well as complex types like \EnumType\, \InputObjectType\, \ObjectType\, \InterfaceType\, and \UnionType\. It also includes supporting structures such as \FieldDefinition\, \Argument\, \InputObjectField\, \EnumValueDefinition\, and \Directive\. New interfaces like \AbstractType\, \CompositeType\, \InputType\, \OutputType\, \LeafType\, \NullableType\, \NamedType\, \HasFieldsType\, and \ImplementingType\ provide a structured contract for type behavior. Additionally, traits like \HasFieldsTypeImplementation\ and \ImplementingTypeImplementation\ offer shared logic for field and interface management, while attributes like \Description\ and \Deprecated\ support modern PHP-based schema definitions.
src/Type/Definition · high confidence
New validation rules for OneOf input objects and disabling introspection
The validator now includes a \OneOfInputObjectsRule\ that enforces the GraphQL \@oneOf\ directive on input objects, requiring exactly one non-null field to be provided. Additionally, a \DisableIntrospection\ rule has been added to allow users to block queries containing \\_\schema\ or \\\_type\ fields, returning a specific error when introspection is disabled.
src/Validator/Rules · high confidence
Repository initialization with comprehensive tooling and documentation
This change establishes the project's foundational structure by adding configuration files for code style (php-cs-fixer, rector), static analysis (PHPStan), testing (PHPUnit), and benchmarking (PHPBench). It includes a detailed changelog, upgrade guide, contributing guidelines, and a security policy, alongside a Makefile to orchestrate these development tasks. The repository also sets up CI/CD configurations (Codecov, Renovate) and updates the license to MIT.
(repo-wide) · high confidence
Behavioural changes
1 commit (0 fixes) modifying examples, src/Language, src/Validator
A change to existing behaviour in examples, src/Language, src/Validator — 1 commit, 3 files: “Update phpstan packages (\#1992)” (refs \#1992). Also in this area: Example demonstrating per-schema scalar overrides.
examples/06-per-schema-scalar-override · low confidence · unverified
AST nodes restructured with strict typing and NodeList collections
The AST node classes in src/Language/AST have been completely rewritten to use strict PHP types and a dedicated NodeList class for collections. Every node now explicitly defines its kind, required properties, and optional fields (like descriptions and directives) using strong typing, replacing previous loose array-based structures. The new NodeList class handles lazy conversion of raw arrays to AST nodes and provides methods for manipulation, improving type safety and performance for schema parsing and validation.
src/Language/AST · high confidence
Complete rewrite of the GraphQL language layer (lexer, parser, printer, and visitor)
The \src/Language\ package has been replaced with a new implementation of the GraphQL language tools. The Lexer now uses an O(N) algorithm with a double-linked list for tokens, improving performance and handling UTF-16 surrogate pairs. The Parser has been updated to the 2016 spec version, adding support for Schema Definition Language (SDL), directives on variable definitions, and repeatable directives, while introducing a \recursionLimit\ option to prevent stack overflows. The Printer now correctly handles block strings and descriptions, and the Visitor utility has been refactored to use a \NodeList\ class for AST collections and new \VisitorOperation\ classes (Skip, Stop, Remove) for traversal control.
src/Language · high confidence
Executor refactored into pluggable implementation with scoped context support
The execution engine has been restructured to support pluggable executor implementations via a new \ExecutorImplementation\ interface and factory pattern, allowing for alternative execution strategies (such as coroutine-based executors) while retaining the \ReferenceExecutor\ as the default. A new \ExecutionContext\ class now centralizes execution state (schema, fragments, variables, and errors), and the \ExecutionResult\ class has been enhanced to support custom error formatters, error handlers, and user-defined extensions. Additionally, a new \ScopedContext\ interface allows context values to be cloned per field, enabling isolated state updates for child fields without affecting siblings.
src/Executor · high confidence
New Deferred class and refactored GraphQL facade for deferred execution
The library introduces a new \Deferred\ class in \src/Deferred.php\ that extends \SyncPromise\ to handle deferred field resolution by enqueuing an executor callback, providing a user-facing promise mechanism for lazy loading. Concurrently, the \src/GraphQL.php\ facade has been refactored to expose \executeQuery\ and \promiseToExecute\ methods, replacing previous static execution patterns; \executeQuery\ now synchronously waits on a promise using \SyncPromiseAdapter\, while \promiseToExecute\ allows integration with async platforms by accepting a custom \PromiseAdapter\. The facade also enforces query complexity validation by setting raw variable values on the \QueryComplexity\ rule before execution and deprecates \getStandardDirectives\ in favor of \Directive::builtInDirectives()\.
src · high confidence
PHPStan configuration now adapts to the runtime PHP version
The static analysis setup has been reworked to automatically select configuration rules based on the PHP version in use. A new entry script loads specific PHPStan configuration files (e.g., for PHP 8.2+, below 8.2, below 8.1, or below 8.0) to handle version-specific issues such as enum support, property access changes, and type narrowing behaviors. This ensures that static analysis remains accurate across different PHP environments without requiring manual configuration overrides.
phpstan · high confidence
Safer default error formatting and new error types
The default error formatter now replaces error messages with "Internal server error" unless the error implements the new ClientAware interface and returns true for isClientSafe(), preventing accidental leakage of sensitive internal details. A new DebugFlag::RETHROW\_UNSAFE\_EXCEPTIONS flag allows re-throwing exceptions that are not client-safe, while DebugFlag::RETHROW\_INTERNAL\_EXCEPTIONS remains for internal errors. New error classes include CoercionError (with input path and invalid value details), SerializationError (for leaf serialization failures), UserError (client-safe), and InvariantViolation. The FormattedError class now uses createFromException for spec-compliant formatting and provides a printError() helper for debugging.
src/Error · high confidence
Simplified blog example with updated schema configuration
The blog example has been refactored to use the new \SchemaConfig\ object for schema construction instead of the previous constructor arguments, and the entry point script has been renamed from \index.php\ to \graphql.php\ for consistency. The example now initializes a fake data source and sets up a standard server with an application context containing the currently logged-in user, providing a clearer starting point for newcomers to understand schema definition and query execution.
examples/01-blog · high confidence
Validation engine restructured with SDL support and new security rules
The validation system has been restructured to support Schema Definition Language (SDL) validation alongside standard query validation. A new \ValidationContext\ interface and \SDLValidationContext\ class allow schemas to be validated during construction, while \DocumentValidator\ now integrates dedicated security rules (\QuerySecurityRule\, \QueryComplexity\, \QueryDepth\) and new validation rules such as \OneOfInputObjectsRule\ and \DisableIntrospection\. Users can now pass custom \TypeInfo\ instances to the validator and benefit from stricter validation coverage for SDL definitions and query security.
src/Validator · high confidence
Validation of non-nullable circular references in Input Objects
The library now detects and reports errors when an Input Object type contains a circular reference chain involving non-nullable fields. This new validation rule prevents schema definitions that would lead to unbreakable cycles during execution, ensuring that input structures are acyclic where non-null constraints apply.
src/Type/Validation · high confidence
Test coverage
Added PHPStan type-specifying extensions for GraphQL type checks; Added Star Wars end-to-end test suite and supporting test utilities; Added comprehensive test coverage for GraphQL Type system definitions; Added comprehensive test coverage for GraphQL Utils; Added comprehensive test coverage for the Language layer; Added comprehensive test suite for GraphQL Executor; Added comprehensive test suite for the GraphQL Server component; Added regression tests for union/interface resolveType paths and input object validation; Added test coverage for GraphQL Error handling and formatting; Added test coverage for GraphQL validation rules; Added test coverage for Promise adapters; Added test fixture classes for executor scenarios; Added test fixtures for PHP Enum type handling; Added test fixtures for custom GraphQL type implementations; Added tests for AST Node cloning, JSON serialization, and string conversion; Added tests for Type definition utilities.
Dependencies
Initial release of graphql-php v15 with PHP 7.4+ support and modern dev tooling
This entry introduces the initial composer.json for the graphql-php library (v15), establishing a minimum PHP version of 7.4 or 8+ and requiring ext-json and ext-mbstring. It configures a comprehensive development environment including PHPStan 2.2.16 with strict rules and PHPUnit extensions, PHP-CS-Fixer 3.95.27, Rector 2.0, and PHPUnit 9.5/10.5/11 support. The package also adds async execution support via AMPHP (v2/v3) and React PHP (v2/v3) adapters, alongside PSR-7/PSR-18 HTTP message compatibility. An example sub-project (05-type-config-decorator) is included, depending on graphql-php ^15.20.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 73.2 → 72.0 (-1.2)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 76.3 → 75.5 (-0.8)
- Architecture 85.9 → 89.3 (+3.4)
- Maturity 66.5 → 66.4 (-0.1)
- Readiness 75.2 → 70.3 (-4.9)
- Security 86.7 → 86.7 (0.0)
- Performance 100.0 → 100.0 (0.0)
Resolved (2)
- Off-boarding risk: anonymized user #1
- Projects may be oversized for their cohesion
New (24)
- Circular dependency (src/GraphQL.php)
- Edited copies of one member (3 members, 12+ corresponding lines) (src/Type/SchemaValidationContext.php)
- Edited copies of one member (3 members, 16+ corresponding lines) (src/Language/Parser.php)
- Edited copies of one member (3 members, 22+ corresponding lines) (src/Utils/BreakingChangesFinder.php)
- Edited copies of one member (3 members, 9+ corresponding lines) (src/Type/Definition/EnumType.php)
- Edited copies of one member (4 members, 6+ corresponding lines) (src/Type/Definition/InputObjectType.php)
- Edited copies of one member (5 members, 16+ corresponding lines) (src/Language/Parser.php)
- Edited copy of a member (10 corresponding lines) (src/Type/Definition/IDType.php)
- Edited copy of a member (11 corresponding lines) (src/Error/Warning.php)
- Edited copy of a member (12 corresponding lines) (src/Executor/Promise/Adapter/AmpFutureAdapter.php)
- Edited copy of a member (14 corresponding lines) (src/Executor/Executor.php)
- Edited copy of a member (15 corresponding lines) (src/Executor/ReferenceExecutor.php)
- Edited copy of a member (16 corresponding lines) (src/Language/Parser.php)
- Edited copy of a member (17 corresponding lines) (src/Utils/SchemaExtender.php)
- Edited copy of a member (19 corresponding lines) (src/Validator/DocumentValidator.php)
- Edited copy of a member (20 corresponding lines) (src/Type/Definition/FieldDefinition.php)
- Edited copy of a member (23 corresponding lines) (src/Validator/Rules/OverlappingFieldsCanBeMerged.php)
- Edited copy of a member (28 corresponding lines) (src/Language/Parser.php)
- Edited copy of a member (29 corresponding lines) (src/Type/SchemaValidationContext.php)
- Edited copy of a member (31 corresponding lines) (src/Utils/SchemaExtender.php)
- …and 4 more
Changes since last survey
- 4 commits — 4 feature/other, 0 fixes
By area
- (root) — 4 commits
Notable commits
- change: Update composer Docker tag to v2.11 (#1999)
- change: Update dependency friendsofphp/php-cs-fixer to v3.95.29
- change: Update dependency phpstan/phpstan to v2.3.5
- change: Update php-cs-fixer packages
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
webonyx/graphql-php was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 53151c72b1b5e1b66a055bda338a101103cdfd44 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.