https://github.com/marco-gallegos/lumen-graphql-api-template
Template / Boilerplate To build GraphQL API's with Lumen 6
https://github.com/marco-gallegos/lumen-graphql-api-template
api api-template boilerplate graphql graphql-php graphql-server laravel lumen lumen-framework template
Last synced: 3 months ago
JSON representation
Template / Boilerplate To build GraphQL API's with Lumen 6
- Host: GitHub
- URL: https://github.com/marco-gallegos/lumen-graphql-api-template
- Owner: marco-gallegos
- Created: 2020-01-21T08:23:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T12:22:48.000Z (over 2 years ago)
- Last Synced: 2025-01-16T13:58:08.388Z (4 months ago)
- Topics: api, api-template, boilerplate, graphql, graphql-php, graphql-server, laravel, lumen, lumen-framework, template
- Language: PHP
- Homepage:
- Size: 228 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Lumen Graphql Template/Boilerplate
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.
## How To Start / Setup
1 - clone the repo with your api/project name
```shellscript
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
## Main Features
Some cool additional features in this template/boilerplate
### Laravel Generators (dev dependency)
Not supported by default in lumen, [a third party package](https://github.com/flipboxstudio/lumen-generator) that provides artisan commands like make:controller or serve
### Graphql Playground (dev dependency)
A sandbox for test your graphql api by [a third party package](https://github.com/mll-lab/laravel-graphql-playground).
Only need to acces to your development server on route /graphql-playground example http://localhost:8000/graphql-playground
### CORS
[Third party package](https://github.com/palanik/lumen-cors) preconfigured to add CORS headers to every request.
### JWT Auth
To Do
## Tips
Use [insomnia](https://insomnia.rest/) for test this project, if you use linux is available in snap store.
```shellscript
sudo snap install insomnia
```## Configuration
### Graphql Server | [Lighthouse](https://lighthouse-php.com/)
steps to make lighthouse plugin works in lumen, inspired by [Bruno Silva on Medium](https://medium.com/@bsilva0x87/how-to-configure-laravel-lumen-with-lighthouse-php-graphql-ad63b8273321)
```shellscript
mkdir ./configcp vendor/nuwave/lighthouse/config/config.php ./config/lighthouse.php
# checking lighthouse file created on schema -> register
# we need to replicate this filemkdir ./graphql
cp vendor/nuwave/lighthouse/assets/default-schema.graphql ./graphql/schema.graphql
```
### Graphql Playground
```shellscript
cp vendor/mll-lab/laravel-graphql-playground/src/graphql-playground.php config/graphql-playground.php
``````php
# adding this to app.php
/*
|--------------------------------------------------------------------------
| GraphQL Playground
|--------------------------------------------------------------------------
|
| Loads mll-lab/laravel-graphql-playground configuration file into the application.
|
*/
$app->configure('graphql-playground');
```## License
The Lumen framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).