2017-08-22 13:05:54 +03:00
# Contributing to GraphQL PHP
## Workflow
If your contribution requires significant or breaking changes, or if you plan to propose a major new feature,
2018-04-15 11:38:16 +03:00
we recommend you to create an issue on the [GitHub ](https://github.com/webonyx/graphql-php/issues ) with
2017-08-22 13:05:54 +03:00
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.
2019-06-10 23:30:25 +03:00
* Check your changes using `composer check-all` .
* Add an entry to the [Changelog's Unreleases section ](CHANGELOG.md#unreleased ).
* Send a pull request.
2017-08-22 13:05:54 +03:00
2019-03-28 13:24:06 +03:00
## Setup the Development Environment
First, copy the URL of your fork and `git clone` it to your local machine.
2018-07-10 00:51:08 +03:00
```sh
cd graphql-php
composer install
2017-08-22 13:05:54 +03:00
```
## Running tests
2018-07-10 00:51:08 +03:00
```sh
./vendor/bin/phpunit
2017-08-22 13:05:54 +03:00
```
2018-07-10 00:51:08 +03:00
2018-09-02 13:07:37 +03:00
Some tests have annotation `@see it('<description>')` . It is used for reference to same tests in [graphql-js implementation ](https://github.com/graphql/graphql-js ) with the same description.
2018-07-10 00:51:08 +03:00
## Coding Standard
2019-03-28 13:24:06 +03:00
The coding standard of this project is based on [Doctrine CS ](https://github.com/doctrine/coding-standard ).
2018-07-10 00:51:08 +03:00
2019-03-28 13:24:06 +03:00
Run the inspections:
2018-07-10 00:51:08 +03:00
```sh
./vendor/bin/phpcs
2017-08-22 13:05:54 +03:00
```
2018-09-26 12:18:02 +03:00
2019-03-28 13:24:06 +03:00
Apply automatic code style fixes:
2018-11-22 15:57:53 +03:00
```sh
./vendor/bin/phpcbf
```
## Static analysis
2019-03-28 13:24:06 +03:00
Based on [PHPStan ](https://github.com/phpstan/phpstan ).
2018-11-22 15:57:53 +03:00
```sh
./vendor/bin/phpstan analyse --ansi --memory-limit 256M
```
2018-09-26 12:18:02 +03:00
## Running benchmarks
2019-03-28 13:24:06 +03:00
Benchmarks are run via [PHPBench ](https://github.com/phpbench/phpbench ).
2018-09-26 12:18:02 +03:00
```sh
2018-11-22 15:57:53 +03:00
./vendor/bin/phpbench run .
2018-09-26 12:18:02 +03:00
```