GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data
this is sample how to integrating Graphql with laravel, for full documentation you can check here and Graphql
1- Require the package via Composer in your composer.json
.
{
"require": {
"barryvdh/laravel-cors": "^0.9.2",
"rebing/graphql-laravel": "dev-master",
"tymon/jwt-auth": "^0.5.11",
"noh4ck/graphiql": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ardani/laravel-graphiql"
}
]
}
2- Run Composer to install or update the new requirement.
$ composer install
3- Create file .env
and setting database in .env
4- Run artisan migrate and seeder
$ php artisan migrate
$ php artisan db:seed
5- Run application
$ php artisan serve
GraphQL : http://127.0.0.1:8000/graphql/query
GraphQL Ui : http://127.0.0.1:8000/graphql-ui