Skip to content

Automatically generate GraphQL types, mutations and queries based on you models

Notifications You must be signed in to change notification settings

dalnix/laravel-graphql-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

Laravel GraphQL Generator

Note: work in progress

This package will help you to generate Types, Queries and Mutations for Folkloreatelier/laravel-graphql's package.

Installation

Install composer package

$ composer install dalnix/laravel-graphql-generator

Use following command to generate your Types, Queries or Mutations, files will be created in app/GraphQL/Type, app/GraphQL/Mutation or app/GraphQL/Query. When creating a new Type, all columns of the table in the database will be imported, if you want to remove some fields that should'nt be able to access via GraphQL, edit your Type fields method.

$ php artisan dalnix:graphql:make

Publish config to change your GraphQL schema

$ php artisan vendor:publish

Test your queries or mutations: (app_url)/graphiql/custom (custom is the default laravel graphql generator schema)

Notes

Laravel graphql generator does not generate complete functioning resolve functions for your queries or mutations, you have to manually edit your queries or mutations to be able to return data.

You can't add relations via the command, to do so you must edit your Types in order to be able to make queries with eager loaded relations, see laravel-graphql's documention on eager loading relationships

Todos

  • Make it possible to add relations directly in the command

License

AGPL-3.0

About

Automatically generate GraphQL types, mutations and queries based on you models

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages