|
1 |
| -# GraphQL integration for Drupal 8 |
| 1 | +# GraphQL for Drupal |
2 | 2 |
|
3 | 3 | [](https://travis-ci.org/fubhy/graphql-drupal)
|
4 | 4 |
|
5 |
| -This module generates and exposes a GraphQL schema for all content entity types. |
| 5 | +This module generates and exposes a [GraphQL] schema for [Drupal 8] entities, and |
| 6 | +allows you to expose your own custom schema in a consistent way and with minimal |
| 7 | +effort. |
6 | 8 |
|
7 |
| -Project homepage: https://www.drupal.org/project/graphql |
| 9 | +It is probably the easiest way to build headless Drupal sites using the popular |
| 10 | +[React] / [Relay] couple for the front-end, and on top of the traditional fast |
| 11 | +Drupal site building for the content modeling and management. |
8 | 12 |
|
9 |
| -## Installation |
| 13 | +[Drupal 8]: https://www.drupal.org/8 |
| 14 | +[GraphQL]: http://graphql.org/ |
| 15 | +[React]: https://facebook.github.io/react/ |
| 16 | +[Relay]: https://facebook.github.io/relay/ |
10 | 17 |
|
11 |
| -In order to install this module, since we are currently using a fork of the library that this module depends on, you |
12 |
| -have to specify a custom repository in your composer.json. |
13 | 18 |
|
14 |
| -``` |
15 |
| - "repositories": [ |
16 |
| - { |
17 |
| - "type": "package", |
18 |
| - "package": { |
19 |
| - "name": "youshido/graphql", |
20 |
| - "version": "dev-drupal", |
21 |
| - "source": { |
22 |
| - "url": "https://github.com/fubhy/GraphQL.git", |
23 |
| - "type": "git", |
24 |
| - "reference": "drupal" |
25 |
| - } |
26 |
| - } |
27 |
| - } |
28 |
| - ] |
29 |
| -``` |
| 19 | +## Features |
30 | 20 |
|
31 |
| -After adding this to your composer.json, you can run "composer require drupal/graphql:8.x-3.x". |
| 21 | +### Built-in schema |
32 | 22 |
|
33 |
| -## Contributing |
| 23 | +By default, the module exposes all content and configuration entities as a |
| 24 | +Relay-compliant schema making the whole Drupal entity reference graph model |
| 25 | +available to clients: entities, ids and references. |
| 26 | + |
| 27 | +It provides a fully data-based process, which does not trigger the theme system, |
| 28 | +and includes full cacheability metadata for low overhead. |
34 | 29 |
|
35 |
| -For some time, development will happen on GitHub using the pull request model: |
36 |
| -in case you are not familiar with that, please take a few minutes to read the |
37 |
| -[GitHub article](https://help.github.com/articles/using-pull-requests) on using |
38 |
| -pull requests. |
39 | 30 |
|
40 |
| -There are a few conventions that should be followed when contributing: |
| 31 | +### Developer experience |
41 | 32 |
|
42 |
| -* Always create an issue in the [drupal.org GraphQL issue queue](https://www.drupal.org/project/issues/graphql) |
43 |
| - for every pull request you are working on. |
44 |
| -* Always cross-reference the Issue in the Pull Request and the Pull Request in |
45 |
| - the issue. |
46 |
| -* Always create a new branch for every pull request: its name should contain a |
47 |
| - brief summary of the ticket and its issue id, e.g **readme-2276369**. |
48 |
| -* Try to keep the history of your pull request as clean as possible by squashing |
49 |
| - your commits: you can look at the [Symfony documentation](http://symfony.com/doc/current/cmf/contributing/commits.html) |
50 |
| - or at the [Git book](http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) |
51 |
| - for more information on how to do that. |
| 33 | +The module is meant as a basis for custom development rather than pure site |
| 34 | +building. As such, at this point it only exposes entity identifiers and labels, |
| 35 | +leaving it up to you as a developer to choose whether/how to expose fields and |
| 36 | +non-entity data. To help you with this task, it provides base objects you only |
| 37 | +need to extend to define your own schema. |
52 | 38 |
|
53 |
| -## Executing the automated tests |
| 39 | +For ease of development, it includes the [GraphiQL] in-browser IDE, already |
| 40 | +configured for Drupal in authenticated mode. |
54 | 41 |
|
55 |
| -This module comes with PHPUnit tests. You need a working Drupal 8 installation |
56 |
| -and a checkout of the GraphQL module in the modules folder. |
| 42 | +[GraphiQL]: https://github.com/graphql/graphiql |
57 | 43 |
|
58 |
| - cd /path/to/drupal-8/core |
59 |
| - ../vendor/bin/phpunit ../modules/graphql/tests/src/Unit |
60 |
| - ../vendor/bin/phpunit ../modules/graphql/tests/src/Integration |
61 | 44 |
|
62 |
| -You can also execute the test cases from the web interface at ``/admin/config/development/testing``. |
| 45 | +## Resources |
| 46 | + |
| 47 | +* Documentation: https://www.gitbook.com/book/fgm/graphql-for-drupal |
| 48 | +* Project homepage: https://www.drupal.org/project/graphql |
| 49 | +* Contributing: https://github.com/fubhy/graphql-drupal |
| 50 | + |
0 commit comments