|
1 |
| -# laravel-graphql-relay |
| 1 | +# laravel-grapql-relay # |
2 | 2 |
|
3 |
| -## Documentation currently under development |
| 3 | +Use Facebook [GraphQL](http://facebook.github.io/graphql/) with [React Relay](https://facebook.github.io/relay/). This package extends graphql-php to work with Laravel and is currently **a work in progress**. You can reference what specifications GraphQL needs to provide to work with Relay in the [documentation](https://facebook.github.io/relay/docs/graphql-relay-specification.html#content). |
4 | 4 |
|
5 |
| -Use Facebook [GraphQL](http://facebook.github.io/graphql/) with [React Relay](https://facebook.github.io/relay/). This package is used alongside [laravel-graphql](https://github.com/Folkloreatelier/laravel-graphql) and is currently **a work in progress**. You can reference what specifications GraphQL needs to provide to work with Relay in the [documentation](https://facebook.github.io/relay/docs/graphql-relay-specification.html#content). |
| 5 | +Although this package no longer depends on [laraval-graphql](https://github.com/Folkloreatelier/laravel-graphql), it laid the foundation for this package which likely wouldn't exist without it. It is also a great alternative if you are using GraphQL w/o support for Relay. |
6 | 6 |
|
7 |
| -## Installation |
| 7 | +Because this package is still in the early stages, breaking changes will occur. We will keep the documentation updated with the current release. Please feel free to contribute, PR are absolutely welcome! |
| 8 | + |
| 9 | +### Installation ### |
8 | 10 |
|
9 | 11 | You must then modify your composer.json file and run composer update to include the latest version of the package in your project.
|
10 | 12 |
|
11 |
| -```json |
| 13 | +```php |
12 | 14 | "require": {
|
13 |
| - "nuwave/laravel-graphql-relay": "0.1.*" |
| 15 | + "nuwave/laravel-graphql-relay": "0.3.*" |
14 | 16 | }
|
15 | 17 | ```
|
16 | 18 |
|
17 |
| -Or you can use the ```composer require``` command from your terminal. |
| 19 | +Or you can use the composer require command from your terminal. |
18 | 20 |
|
19 |
| -```json |
| 21 | +``` |
20 | 22 | composer require nuwave/laravel-graphql-relay
|
21 | 23 | ```
|
22 | 24 |
|
23 | 25 | Add the service provider to your ```app/config.php``` file
|
24 | 26 |
|
25 |
| -```php |
26 |
| -Nuwave\Relay\ServiceProvider::class |
| 27 | +``` |
| 28 | +Nuwave\Relay\LaravelServiceProvider::class |
27 | 29 | ```
|
28 | 30 |
|
29 |
| -Add the following entries to your ```config/graphql.php``` file ([laravel-graphql configuration file](https://github.com/Folkloreatelier/laravel-graphql#installation-1)) |
| 31 | +Add the Relay & GraphQL facade to your app/config.php file |
30 | 32 |
|
31 |
| -```php |
| 33 | +``` |
| 34 | +'GraphQL' => Nuwave\Relay\Facades\GraphQL::class, |
| 35 | +'Relay' => Nuwave\Relay\Facades\Relay::class, |
| 36 | +``` |
| 37 | + |
| 38 | +Publish the configuration file |
| 39 | + |
| 40 | +``` |
| 41 | +php artisan vendor:publish --provider="Nuwave\Relay\LaravelServiceProvider" |
| 42 | +``` |
| 43 | + |
| 44 | +Create a ```schema.php``` file and add the path to the config |
| 45 | + |
| 46 | +``` |
| 47 | +// config/relay.php |
| 48 | +// ... |
32 | 49 | 'schema' => [
|
33 |
| - 'query' => [ |
34 |
| - // ... |
35 |
| - 'node' => Nuwave\Relay\Node\NodeQuery::class, |
36 |
| - ], |
37 |
| - // ... |
| 50 | + 'path' => 'Http/schema.php', |
| 51 | + 'output' => null, |
38 | 52 | ],
|
39 |
| -'types' => [ |
40 |
| - // ... |
41 |
| - 'node' => Nuwave\Relay\Node\NodeType::class, |
42 |
| - 'pageInfo' => Nuwave\Relay\Types\PageInfoType::class, |
43 |
| -] |
44 | 53 | ```
|
45 | 54 |
|
46 |
| -To generate a ```schema.json``` file (used with the [Babel Relay Plugin](https://facebook.github.io/relay/docs/guides-babel-plugin.html#content)) |
| 55 | +To generate a ```schema.json``` file (used with the Babel Relay Plugin): |
47 | 56 |
|
48 |
| -```php |
| 57 | +``` |
49 | 58 | php artisan relay:schema
|
50 | 59 | ```
|
51 | 60 |
|
52 |
| -For additional documentation, please read the [Wiki](https://github.com/nuwave/laravel-graphql-relay/wiki/1.-GraphQL-and-Relay) |
| 61 | +*You can customize the output path in the ```relay.php``` config file under ```schema.output```* |
| 62 | + |
| 63 | +For additional documentation, look through the docs folder or read the Wiki. |
0 commit comments