If your contribution requires significant or breaking changes, or if you plan to propose a major new feature, we recommend you to create an issue with a brief proposal and discuss it with us first.
For smaller contributions just use this workflow:
- Fork the project.
- Add your features and or bug fixes.
- Add tests. Tests are important for us.
- Check your changes using
composer check. - Add an entry to the Changelog's Unreleased section.
- Send a pull request.
git clone <your-fork-url>
cd graphql-php
composer installWe ensure the code works and continues to work as expected with PHPUnit.
Run unit tests:
composer testSome tests have an annotation such as @see it('<description>').
It references a matching test in the graphql-js implementation.
When porting tests that utilize the dedent() test utility from graphql-js,
we instead use the PHP native nowdoc syntax.
If the string contents are in a specific grammar, use an appropriate tag such as GRAPHQL, PHP or JSON:
self::assertSomePrintedOutputExactlyMatches(
<<<'GRAPHQL'
type Foo {
bar: Baz
}
GRAPHQL,
$output
);We format the code automatically with php-cs-fixer.
Apply automatic code style fixes:
composer fixWe validate code correctness with PHPStan.
Run static analysis:
composer stanRegenerate the PHPStan baseline:
composer baselineWe benchmark performance critical code with PHPBench.
Check performance:
composer benchWe document this library by rendering the Markdown files in docs with MkDocs.
Generate the class reference docs:
composer docs