Skip to content
This repository was archived by the owner on Mar 29, 2020. It is now read-only.

Merge develop branch #10

Merged
merged 70 commits into from
Mar 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
fc5b976
collecting collections on query
chrissm79 Jan 28, 2016
753a4fa
inject parser
chrissm79 Jan 28, 2016
fd55d6f
rename ast field namespace
chrissm79 Jan 28, 2016
21afcbc
fix namespace
chrissm79 Jan 28, 2016
f4b96d7
avoid including connections in mutations (for now)
chrissm79 Jan 28, 2016
91f63d3
added connection autoloading
chrissm79 Jan 30, 2016
1e301e5
make autoload optional
chrissm79 Jan 30, 2016
622977b
include reference to original relay id
chrissm79 Feb 12, 2016
0e5eaba
create relay file generators
chrissm79 Feb 12, 2016
342c199
fix mutation make name
chrissm79 Feb 12, 2016
b980889
Merge branch 'master' into develop
chrissm79 Feb 12, 2016
c3db5cb
Update composer.json
bcarroll22 Feb 25, 2016
fca716a
Working on connection types
Feb 26, 2016
0101e50
default schema
Feb 26, 2016
5b79d7f
Merge pull request #7 from bcarroll22/develop
chrissm79 Feb 27, 2016
7f4b7d5
remove connection for name
chrissm79 Feb 27, 2016
66e31c0
removed eloquent model dependency
chrissm79 Feb 27, 2016
723e715
use new LaravelServiceProvider
chrissm79 Feb 27, 2016
f5373b7
merge config w/ graphql
chrissm79 Feb 27, 2016
2933af3
don't override set resolve function
chrissm79 Feb 27, 2016
0b7bd04
re-add getCursorId
chrissm79 Feb 27, 2016
6dae534
created GraphQL container
chrissm79 Feb 28, 2016
d1b9f1c
created eloquent type
chrissm79 Feb 28, 2016
4964814
use fields generated in model if available
chrissm79 Feb 29, 2016
da3a1fe
generate raw fields for use in stub
chrissm79 Mar 3, 2016
dc9faa9
add model option to type make command
chrissm79 Mar 4, 2016
083de1b
add connection method to GraphQL
chrissm79 Mar 4, 2016
97dee77
remove field import
chrissm79 Mar 4, 2016
28012b6
swapped out GraphQL implementation
chrissm79 Mar 4, 2016
9ac6e54
restructured folders
chrissm79 Mar 4, 2016
c212a71
Remove remaining Folklore packages
chrissm79 Mar 4, 2016
af84f22
remove folklore dependency
chrissm79 Mar 4, 2016
2754a6e
fix base model name
chrissm79 Mar 4, 2016
194828b
update node type attribute declaration
chrissm79 Mar 4, 2016
47a0fa9
fix node query import
chrissm79 Mar 4, 2016
30c7e02
expose types to avoid circular reference
chrissm79 Mar 5, 2016
b10768d
add cache to retrieve EloquentType fields
chrissm79 Mar 5, 2016
87b103b
add cache command
chrissm79 Mar 5, 2016
a0fa9f9
flush cache before generation in command
chrissm79 Mar 6, 2016
e72cdb6
allow camel cased fields
chrissm79 Mar 6, 2016
65f9e57
ensure path exists before removing
chrissm79 Mar 6, 2016
64f5af8
grab instances from IoC container
chrissm79 Mar 7, 2016
c49e8f1
only cache generated fields
chrissm79 Mar 7, 2016
563c81b
store edge instances
chrissm79 Mar 7, 2016
21f8500
remove graphql config settings
chrissm79 Mar 7, 2016
32f0724
update tests
chrissm79 Mar 7, 2016
07d4698
fields for eloquent models attached to mutliple types
chrissm79 Mar 8, 2016
df4b69e
update configuration
chrissm79 Mar 9, 2016
8369c72
fix namespace
chrissm79 Mar 9, 2016
e7811fb
add doctrine to requirements
chrissm79 Mar 9, 2016
d1069c2
fix extended class names
chrissm79 Mar 9, 2016
e241092
rename file to path
chrissm79 Mar 9, 2016
d81b74d
register relay types before populating config
chrissm79 Mar 9, 2016
ee34e0d
fix issue with validation
chrissm79 Mar 9, 2016
ff8f5f1
move validation to field
chrissm79 Mar 9, 2016
4153827
use same validation method for relay mutation
chrissm79 Mar 9, 2016
8c69950
add query function to relay trait
chrissm79 Mar 9, 2016
80257b2
added default route/controller
chrissm79 Mar 9, 2016
8d32bf4
add controller to config
chrissm79 Mar 9, 2016
6b07b2b
correct path to introspection query
chrissm79 Mar 10, 2016
a022444
inital set of revised docs
chrissm79 Mar 11, 2016
aca4613
drop query select
chrissm79 Mar 12, 2016
08c98c6
add eager loading helper method
chrissm79 Mar 12, 2016
8126181
use eager loaded relations
chrissm79 Mar 12, 2016
1724408
add relay documentation
chrissm79 Mar 12, 2016
da1c8ac
add schema generation to overview
chrissm79 Mar 12, 2016
6fb6069
update documentation
chrissm79 Mar 12, 2016
330d8bb
replace readme
chrissm79 Mar 12, 2016
0b8b2c1
Merge branch 'master' of https://github.com/nuwave/laravel-graphql-relay
chrissm79 Mar 12, 2016
aa32636
Merge branch 'master' into develop
chrissm79 Mar 12, 2016
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
80 changes: 30 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,63 @@
# laravel-graphql-relay
# laravel-grapql-relay #

## Documentation currently under development
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).

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).
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.

## Installation
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!

### Installation ###

You must then modify your composer.json file and run composer update to include the latest version of the package in your project.

```json
```php
"require": {
"nuwave/laravel-graphql-relay": "0.2.*"
"nuwave/laravel-graphql-relay": "0.3.*"
}
```

Or you can use the ```composer require``` command from your terminal.
Or you can use the composer require command from your terminal.

```json
```
composer require nuwave/laravel-graphql-relay
```

Add the service provider to your ```app/config.php``` file

```php
Nuwave\Relay\ServiceProvider::class
```
Nuwave\Relay\LaravelServiceProvider::class
```

Add the Relay facade to your ```app/config.php``` file
Add the Relay & GraphQL facade to your app/config.php file

```php
```
'GraphQL' => Nuwave\Relay\Facades\GraphQL::class,
'Relay' => Nuwave\Relay\Facades\Relay::class,
```

Publish the configuration file

```php
php artisan vendor:publish --provider="Nuwave\Relay\ServiceProvider"
```
php artisan vendor:publish --provider="Nuwave\Relay\LaravelServiceProvider"
```

Add your Mutations, Queries and Types to the ```config/relay.php``` file
Create a ```schema.php``` file and add the path to the config

```php
// Example:

return [
'schema' => function () {
// Added by default
Relay::group(['namespace' => 'Nuwave\\Relay'], function () {
Relay::group(['namespace' => 'Node'], function () {
Relay::query('node', 'NodeQuery');
Relay::type('node', 'NodeType');
});

Relay::type('pageInfo', 'Types\\PageInfoType');
});

// Your mutations, queries and types
Relay::group(['namespace' => 'App\\Http\\GraphQL'], function () {
Relay::group(['namespace' => 'Mutations'], function () {
Relay::mutation('createUser', 'CreateUserMutation');
});

Relay::group(['namespace' => 'Queries', function () {
Relay::query('userQuery', 'UserQuery');
});

Relay::group(['namespace' => 'Types'], function () {
Relay::type('user', 'UserType');
Relay::type('event', 'EventType');
});
});
}
];
```
// config/relay.php
// ...
'schema' => [
'path' => 'Http/schema.php',
'output' => null,
],
```

To generate a ```schema.json``` file (used with the [Babel Relay Plugin](https://facebook.github.io/relay/docs/guides-babel-plugin.html#content))
To generate a ```schema.json``` file (used with the Babel Relay Plugin):

```php
```
php artisan relay:schema
```

For additional documentation, please read the [Wiki](https://github.com/nuwave/laravel-graphql-relay/wiki/1.-GraphQL-and-Relay)
*You can customize the output path in the ```relay.php``` config file under ```schema.output```*

For additional documentation, look through the docs folder or read the Wiki.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
}
},
"require": {
"folklore/graphql": "0.*",
"illuminate/console": "5.*"
"webonyx/graphql-php": "~0.5",
"illuminate/console": "5.*",
"doctrine/dbal": "^2.5"
}
}
56 changes: 37 additions & 19 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
<?php
/*
|--------------------------------------------------------------------------
| Schema File
|--------------------------------------------------------------------------
|
| You can utilize this file to register all of you GraphQL schma queries
| and mutations. You can group collections together by namespace or middlware.
|
*/

return [
'schema' => function () {
Relay::group(['namespace' => 'Nuwave\\Relay'], function () {
Relay::group(['namespace' => 'Node'], function () {
Relay::query('node', 'NodeQuery');
Relay::type('node', 'NodeType');
});

Relay::type('pageInfo', 'Types\\PageInfoType');
});
/*
|--------------------------------------------------------------------------
| Namespace registry
|--------------------------------------------------------------------------
|
| This package provides a set of commands to make it easy for you to
| create new parts in your GraphQL schema. Change these values to
| match the namespaces you'd like each piece to be created in.
|
*/

// Additional Queries, Mutations and Types...
}
'namespaces' => [
'mutations' => 'App\\GraphQL\\Mutations',
'queries' => 'App\\GraphQL\\Queries',
'types' => 'App\\GraphQL\\Types',
'fields' => 'App\\GraphQL\\Fields',
],

/*
|--------------------------------------------------------------------------
| Schema declaration
|--------------------------------------------------------------------------
|
| This is a path that points to where your Relay schema is located
| relative to the app path. You should define your entire Relay
| schema in this file. Declare any Relay queries, mutations,
| and types here instead of laravel-graphql config file.
|
*/

'schema' => [
'path' => null,
'output' => null,
],

'controller' => 'Nuwave\Relay\Http\Controllers\LaravelController@query',
'model_path' => 'App\\Models',
'camel_case' => false,
];
52 changes: 52 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Configuration ##

When publishing the configuration, the package will create a ```relay.php``` file in your ```config``` folder.

### Namespaces ###

```php
'namespaces' => [
'mutations' => 'App\\GraphQL\\Mutations',
'queries' => 'App\\GraphQL\\Queries',
'types' => 'App\\GraphQL\\Types',
'fields' => 'App\\GraphQL\\Fields',
],
```

This package provides a list of commands that allows you to create Types, Mutations, Queries and Fields. You can specify the namespaces you would like the package to use when generating the files.

### Schema ###

```php
'schema' => [
'file' => 'Http/GraphQL/schema.php',
'output' => null,
]
```

** File **

Set the location of your schema file. (A schema is similar to your routes.php file and defines your Types, Mutations and Queries for GraphQL. Read More)

** Output **

This is the location where your generated ```schema.json``` will be created/updated. (This json file is used by the [Babel Relay Plugin](https://facebook.github.io/relay/docs/guides-babel-plugin.html#content)).

### Eloquent ###

```php
'eloquent' => [
'path' => 'App\\Models',
'camel_case' => false
]
```

** Path **

The package allows you to create Types based off of your Eloquent models. You can use the ```path``` to define the namespace of your models or you can use the full namespace when generating Types from the console (Read More).

** Camel Case **

Camel casing is quite common in javascript, but Laravel's database column naming convention is snake case. If you would like your Eloquent model's generated fields converted to camel case, you may set this to true.

*This works great with the [Eloquence package](https://github.com/kirkbushell/eloquence).*
63 changes: 63 additions & 0 deletions docs/Overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# laravel-grapql-relay #

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).

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.

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!

### Installation ###

You must then modify your composer.json file and run composer update to include the latest version of the package in your project.

```php
"require": {
"nuwave/laravel-graphql-relay": "0.3.*"
}
```

Or you can use the composer require command from your terminal.

```
composer require nuwave/laravel-graphql-relay
```

Add the service provider to your ```app/config.php``` file

```
Nuwave\Relay\LaravelServiceProvider::class
```

Add the Relay & GraphQL facade to your app/config.php file

```
'GraphQL' => Nuwave\Relay\Facades\GraphQL::class,
'Relay' => Nuwave\Relay\Facades\Relay::class,
```

Publish the configuration file

```
php artisan vendor:publish --provider="Nuwave\Relay\LaravelServiceProvider"
```

Create a ```schema.php``` file and add the path to the config

```
// config/relay.php
// ...
'schema' => [
'path' => 'Http/schema.php',
'output' => null,
],
```

To generate a ```schema.json``` file (used with the Babel Relay Plugin):

```
php artisan relay:schema
```

*You can customize the output path in the ```relay.php``` config file under ```schema.output```*

For additional documentation, look through the docs folder or read the Wiki.
Loading