The objective of this repo is build a graphql api boilerplate/template in lumen because at the time of building this project there was no attempt at github.
graphql is great, i use it on python and want to make it easier in php.
1 - clone the repo with your api/project name
git clone https://github.com/marco-gallegos/lumen-graphql-template "your project name"
cd "your project name"
composer install
cp .env.example .env
2 - Nothing to do, serve and let's code. don't forget visit the /graphql-playground route
Some cool additional features in this template/boilerplate
Not supported by default in lumen, a third party package that provides artisan commands like make:controller or serve
A sandbox for test your graphql api by a third party package.
Only need to acces to your development server on route /graphql-playground example http://localhost:8000/graphql-playground
Third party package preconfigured to add CORS headers to every request.
To Do
Use insomnia for test this project, if you use linux is available in snap store.
sudo snap install insomnia
Graphql Server | Lighthouse
steps to make lighthouse plugin works in lumen, inspired by Bruno Silva on Medium
mkdir ./config
cp vendor/nuwave/lighthouse/config/config.php ./config/lighthouse.php
# checking lighthouse file created on schema -> register
# we need to replicate this file
mkdir ./graphql
cp vendor/nuwave/lighthouse/assets/default-schema.graphql ./graphql/schema.graphql
cp vendor/mll-lab/laravel-graphql-playground/src/graphql-playground.php config/graphql-playground.php
# adding this to app.php
/*
|--------------------------------------------------------------------------
| GraphQL Playground
|--------------------------------------------------------------------------
|
| Loads mll-lab/laravel-graphql-playground configuration file into the application.
|
*/
$app->configure('graphql-playground');
The Lumen framework is open-sourced software licensed under the MIT license.