Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ai/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The following elements are part of the stable public API:
- Keep changes focused and minimal.
- Run `make stan` and `make test` for behavioral changes.
- Use `make fix` for style/refactoring consistency when needed.
- Only add `/** @see it('...') */` to a test when it has a direct counterpart with that exact name in graphql-js.

## Release Workflow

Expand Down
15 changes: 10 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ You can find and compare releases at the [GitHub release page](https://github.co

## Unreleased

### Fixed

- Fix `SingleFieldSubscription` validation to expand fragments before counting root fields, reject introspection fields, and reject `@skip`/`@include` at the subscription root https://github.com/webonyx/graphql-php/pull/1930
- This release completes full compliance with the [October 2021 GraphQL specification](https://spec.graphql.org/October2021)
Comment thread
spawnia marked this conversation as resolved.

## v15.33.0

### Added
Expand Down Expand Up @@ -983,15 +988,15 @@ This release brings several breaking changes. Please refer to [UPGRADE](UPGRADE.

- Support repeatable directives (https://github.com/webonyx/graphql-php/issues/643)
- Support SDL Validation and other schema validation improvements (e.g. https://github.com/webonyx/graphql-php/issues/492)
- Added promise adapter for [Amp](https://amphp.org/) (https://github.com/webonyx/graphql-php/issues/551)
- Added promise adapter for [Amp](https://amphp.org) (https://github.com/webonyx/graphql-php/issues/551)
- Query plan utility improvements (https://github.com/webonyx/graphql-php/issues/513, https://github.com/webonyx/graphql-php/issues/632)
- Allow retrieving query complexity once query has been completed (https://github.com/webonyx/graphql-php/issues/316)
- Allow input types to be passed in from variables using \stdClass instead of associative arrays (https://github.com/webonyx/graphql-php/issues/535)
- Support UTF-16 surrogate pairs within string literals (https://github.com/webonyx/graphql-php/issues/554, https://github.com/webonyx/graphql-php/issues/556)

### Changed

- Compliant with the GraphQL specification [June 2018 Edition](https://spec.graphql.org/June2018/)
- Compliant with the GraphQL specification [June 2018 Edition](https://spec.graphql.org/June2018)
- Having an empty string in `deprecationReason` will now print the `@deprecated` directive (only a `null` `deprecationReason` won't print the `@deprecated` directive).

### Optimized
Expand Down Expand Up @@ -1167,19 +1172,19 @@ New features and notable changes:
- Changed minimum PHP version from 5.4 to 5.5
- Lazy loading of types without separate build step (see https://github.com/webonyx/graphql-php/issues/69, see [docs](https://webonyx.github.io/graphql-php/type-system/schema/#lazy-loading-of-types))
- PSR-7 compliant Standard Server (see [docs](https://webonyx.github.io/graphql-php/executing-queries/#using-server))
- New default error formatting, which does not expose sensitive data (see [docs](https://webonyx.github.io/graphql-php/error-handling/))
- New default error formatting, which does not expose sensitive data (see [docs](https://webonyx.github.io/graphql-php/error-handling))
- Ability to define custom error handler to filter/log/re-throw exceptions after execution (see [docs](https://webonyx.github.io/graphql-php/error-handling/#custom-error-handling-and-formatting))
- Allow defining schema configuration using objects with fluent setters vs array (see [docs](https://webonyx.github.io/graphql-php/type-system/schema/#using-config-class))
- Allow serializing AST to array and re-creating AST from array lazily (see [docs](https://webonyx.github.io/graphql-php/reference/#graphqlutilsast))
- [Apollo-style](https://dev-blog.apollodata.com/query-batching-in-apollo-63acfd859862) query batching support via server (see [docs](https://webonyx.github.io/graphql-php/executing-queries/#query-batching))
- Schema validation, including validation of interface implementations (see [docs](https://webonyx.github.io/graphql-php/type-system/schema/#schema-validation))
- Ability to pass custom config formatter when defining schema using [GraphQL type language](http://graphql.org/learn/schema/#type-language) (see [docs](https://webonyx.github.io/graphql-php/type-system/type-language/))
- Ability to pass custom config formatter when defining schema using [GraphQL type language](http://graphql.org/learn/schema/#type-language) (see [docs](https://webonyx.github.io/graphql-php/type-system/type-language))

Improvements:

- Significantly improved parser performance (see https://github.com/webonyx/graphql-php/issues/137 and https://github.com/webonyx/graphql-php/issues/128)
- Support for PHP7 exceptions everywhere (see https://github.com/webonyx/graphql-php/issues/127)
- Improved [documentation](https://webonyx.github.io/graphql-php/) and docblock comments
- Improved [documentation](https://webonyx.github.io/graphql-php) and docblock comments

Deprecations and breaking changes - see [UPGRADE](UPGRADE.md) document.

Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ composer test
```

Some tests have an annotation such as `@see it('<description>')`.
It references a matching test in the [graphql-js implementation](https://github.com/graphql/graphql-js).
It references a test with the exact same name in the [graphql-js reference implementation](https://github.com/graphql/graphql-js).
Only add `@see it(...)` when the test has a direct counterpart in graphql-js with that exact name.

When porting tests that utilize [the `dedent()` test utility from `graphql-js`](https://github.com/graphql/graphql-js/blob/99d6079434/src/__testUtils__/dedent.js),
we instead use [the PHP native `nowdoc` syntax](https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc).
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
This is a PHP implementation of the [GraphQL](https://graphql.org) [specification](https://github.com/graphql/graphql-spec)
based on the [reference implementation in JavaScript](https://github.com/graphql/graphql-js).

Fully compliant with the [October 2021 GraphQL specification](https://spec.graphql.org/October2021).
[September 2025 specification](https://spec.graphql.org/September2025) compliance is [in progress](https://github.com/webonyx/graphql-php/issues/1931).

## Sponsors

If you make money using this project, please consider sponsoring [its maintainer on GitHub Sponsors](https://github.com/sponsors/spawnia) or [the project on OpenCollective](https://opencollective.com/webonyx-graphql-php).
Expand Down
4 changes: 2 additions & 2 deletions docs/complementary-tools.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Server Integrations

- [Standard Server](executing-queries.md#using-server) – Out of the box integration with any PSR-7 compatible framework (like [Slim](https://slimframework.com) or [Laminas Mezzio](https://docs.mezzio.dev/mezzio/))
- [Standard Server](executing-queries.md#using-server) – Out of the box integration with any PSR-7 compatible framework (like [Slim](https://slimframework.com) or [Laminas Mezzio](https://docs.mezzio.dev/mezzio))
- [Lighthouse](https://github.com/nuwave/lighthouse) – Laravel package, SDL-first
- [Laravel GraphQL](https://github.com/rebing/graphql-laravel) - Laravel package, code-first
- [OverblogGraphQLBundle](https://github.com/overblog/GraphQLBundle) – Symfony bundle
Expand All @@ -19,7 +19,7 @@
- [GraphQL Batch Processor](https://github.com/vasily-kartashov/graphql-batch-processing) – Provides a builder interface for defining collection, querying, filtering, and post-processing logic of batched data fetches
- [GraphQL Utils](https://github.com/simPod/GraphQL-Utils) – Objective schema definition builders (no need for arrays anymore)
- [Relay Library](https://github.com/ivome/graphql-relay-php) – Helps construct Relay related schema definitions
- [Resonance/GraphQL](https://resonance.distantmagic.com/docs/features/graphql/) – Integrates with Swoole for parallelism. Define your schema code-first with annotations.
- [Resonance/GraphQL](https://resonance.distantmagic.com/docs/features/graphql) – Integrates with Swoole for parallelism. Define your schema code-first with annotations.
- [GraphQL PHP Validation Toolkit](https://github.com/shmax/graphql-php-validation-toolkit) - Small library for validation of user input
- [MLL Scalars](https://github.com/mll-lab/graphql-php-scalars) - Collection of custom scalar types
- [X GraphQL](https://github.com/x-graphql) - Provides set of libraries for building http schema, schema gateway, transforming schema, generating PHP code from execution definition, and more.
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ $blogPostType = new ObjectType([

## Further Reading

To get deeper understanding of GraphQL concepts - [read the docs on official GraphQL website](https://graphql.org/learn/)
To get deeper understanding of GraphQL concepts - [read the docs on official GraphQL website](https://graphql.org/learn)

To get started with **graphql-php** - continue to next section ["Getting Started"](getting-started.md)
6 changes: 3 additions & 3 deletions docs/data-fetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ $queryType = new ObjectType([
Since: 0.9.0

One of the most annoying problems with data fetching is a so-called
[N+1 problem](https://secure.phabricator.com/book/phabcontrib/article/n_plus_one/). <br>
[N+1 problem](https://secure.phabricator.com/book/phabcontrib/article/n_plus_one). <br>
Consider following GraphQL query:

```graphql
Expand Down Expand Up @@ -262,7 +262,7 @@ If your project runs in an environment that supports async operations
you can leverage the power of your platform to resolve some fields asynchronously.

The only requirement: your platform must support the concept of Promises compatible with
[Promises A+](https://promisesaplus.com/) specification.
[Promises A+](https://promisesaplus.com) specification.

To start using this feature, switch facade method for query execution from
**executeQuery** to **promiseToExecute**:
Expand Down Expand Up @@ -293,7 +293,7 @@ Where **$promiseAdapter** is an instance of:
- For [AMPHP](https://github.com/amphp/amp): <br>
`GraphQL\Executor\Promise\Adapter\AmpPromiseAdapter`

- For [Swoole](https://swoole.com/) or [OpenSwoole](https://openswoole.com/): <br>
- For [Swoole](https://swoole.com) or [OpenSwoole](https://openswoole.com): <br>
You can use an external library: [Resonance](https://resonance.distantmagic.com/docs/features/graphql/standalone-promise-adapter.html)

- Other platforms: write your own class implementing interface: <br>
Expand Down
8 changes: 4 additions & 4 deletions docs/executing-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $server = new StandardServer([/* server options, see below */]);
$server->handleRequest(); // parses PHP globals and emits response
```

Server also supports [PSR-7 request/response interfaces](https://www.php-fig.org/psr/psr-7/):
Server also supports [PSR-7 request/response interfaces](https://www.php-fig.org/psr/psr-7):

```php
use GraphQL\Server\StandardServer;
Expand Down Expand Up @@ -92,7 +92,7 @@ PSR-7 is useful when you want to integrate the server into existing framework:
- [PSR-7 for Laravel](https://laravel.com/docs/requests#psr7-requests)
- [Symfony PSR-7 Bridge](https://symfony.com/doc/current/components/psr7.html)
- [Slim](https://www.slimframework.com/docs/v4/concepts/value-objects.html)
- [Laminas Mezzio](https://docs.mezzio.dev/mezzio/)
- [Laminas Mezzio](https://docs.mezzio.dev/mezzio)

### Server configuration options

Expand All @@ -103,7 +103,7 @@ PSR-7 is useful when you want to integrate the server into existing framework:
| context | `mixed` | Any value that holds information shared between all field resolvers. Most often they use it to pass currently logged in user, locale details, etc.<br><br>It will be available as the 3rd argument in all field resolvers. (see section on [Field Definitions](type-definitions/object-types.md#field-configuration-options) for reference) **graphql-php** never modifies this value and passes it _as is_ to all underlying resolvers. |
| fieldResolver | `callable` | A resolver function to use when one is not provided by the schema. If not provided, the [default field resolver is used](data-fetching.md#default-field-resolver). |
| validationRules | `array` or `callable` | A set of rules for query validation step. The default value is all available rules. The empty array would allow skipping query validation (may be convenient for persisted queries which are validated before persisting and assumed valid during execution).<br><br>Pass `callable` to return different validation rules for different queries (e.g. empty array for persisted query and a full list of rules for regular queries). When passed, it is expected to have the following signature: <br><br> **function ([OperationParams](class-reference.md#graphqlserveroperationparams) $params, DocumentNode $node, $operationType): array** |
| queryBatching | `bool` | Flag indicating whether this server supports query batching ([apollo-style](https://www.apollographql.com/blog/apollo-client/performance/query-batching/)).<br><br> Defaults to **false** |
| queryBatching | `bool` | Flag indicating whether this server supports query batching ([apollo-style](https://www.apollographql.com/blog/apollo-client/performance/query-batching)).<br><br> Defaults to **false** |
| debugFlag | `int` | Debug flags. See [docs on error debugging](error-handling.md#debugging-tools) (flag values are the same). |
| persistedQueryLoader | `callable` | A function which is called to fetch actual query when server encounters a **queryId**.<br><br> The server does not implement persistence part (which you will have to build on your own), but it allows you to execute queries which were persisted previously.<br><br> Expected function signature:<br> **function ($queryId, [OperationParams](class-reference.md#graphqlserveroperationparams) $params)** <br><br>Function is expected to return query **string** or parsed **DocumentNode** <br><br> [Read more about persisted queries](https://www.apollographql.com/blog/apollo-client/persisted-graphql-queries). |
| errorFormatter | `callable` | Custom error formatter. See [error handling docs](error-handling.md#custom-error-handling-and-formatting). |
Expand All @@ -130,7 +130,7 @@ $server = new StandardServer($config);

## Query batching

Standard Server supports query batching ([apollo-style](https://www.apollographql.com/blog/apollo-client/performance/query-batching/)).
Standard Server supports query batching ([apollo-style](https://www.apollographql.com/blog/apollo-client/performance/query-batching)).

One of the major benefits of Server over a sequence of **executeQuery()** calls is that
[Deferred resolvers](data-fetching.md#solving-n1-problem) won't be isolated in queries.
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Prerequisites

This documentation assumes your familiarity with GraphQL concepts. If it is not the case -
first learn about GraphQL on [the official website](https://graphql.org/learn/).
first learn about GraphQL on [the official website](https://graphql.org/learn).

## Installation

Expand Down
10 changes: 4 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ It is intended to be an alternative to REST and SOAP APIs (even for **existing a

GraphQL itself is a [specification](https://github.com/graphql/graphql-spec) designed by Facebook
engineers. Various implementations of this specification were written
[in different languages and environments](https://graphql.org/code/).
[in different languages and environments](https://graphql.org/code).

Great overview of GraphQL features and benefits is presented on [the official website](https://graphql.org/).
Great overview of GraphQL features and benefits is presented on [the official website](https://graphql.org).
All of them equally apply to this PHP implementation.

## About graphql-php
Expand Down Expand Up @@ -46,10 +46,8 @@ existing PHP frameworks, add support for Relay, etc.

The first version of this library (v0.1) was released on August 10th 2015.

The current version supports all features described by GraphQL specification
as well as some experimental features like
[schema definition language](schema-definition-language.md) and
[schema printer](class-reference.md#graphqlutilsschemaprinter).
Fully compliant with the [October 2021 GraphQL specification](https://spec.graphql.org/October2021).
[September 2025 specification](https://spec.graphql.org/September2025) compliance is [in progress](https://github.com/webonyx/graphql-php/issues/1931).

Ready for real-world usage.

Expand Down
2 changes: 1 addition & 1 deletion docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ This will set the rule globally. Alternatively, you can provide validation rules

## Disabling Introspection

[Introspection](https://graphql.org/learn/introspection/) is a mechanism for fetching schema structure.
[Introspection](https://graphql.org/learn/introspection) is a mechanism for fetching schema structure.
It is used by tools like GraphiQL for auto-completion, query validation, etc.

Introspection is enabled by default. It means that anybody can get a full description of your schema by
Expand Down
2 changes: 1 addition & 1 deletion examples/04-async-php/amphp/http-server/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## HTTP-Server example with AMPHP

This is a basic example using [AMPHP](https://amphp.org/).
This is a basic example using [AMPHP](https://amphp.org).

### Dependencies

Expand Down
Loading
Loading