GraphQL module for the Laravel and Lumen PHP frameworks.
Run the following command to install the package through Composer:
composer require digiaonline/lumen-graphqlCopy the configuration template in config/graphql.php to your application's config directory and modify according to your needs.
For more information see the Configuration Files section in the Lumen documentation.
Available configuration options:
- schema
stringSchema class name, must be an instance ofYoushido\GraphQL\Schema\Schema - type_resolver
stringType resolver class name, must be an instance ofDigia\Lumen\GraphQL\Contracts\TypeResolverInterface - processor
stringOptional processor class name, must be an instance ofYoushido\GraphQL\Execution\Processor - enable_graphiql
boolWhether or not the GraphiQL interface is enabled - graphiql_token
stringToken required for accessing the GraphiQL interface
Add the following line to bootstrap/app.php:
$app->register(Digia\Lumen\GraphQL\GraphQLServiceProvider::class);Add the following lines to routes/web.php:
$router->get('/graphql', [
'uses' => 'Digia\Lumen\GraphQL\Http\GraphQLController@renderGraphiQL',
]);
$router->post('/graphql', [
'uses' => 'Digia\Lumen\GraphQL\Http\GraphQLController@handle',
]);NOTE: Make sure that your route group does not have a namespace attribute. Otherwise Lumen will be unable to find the GraphQLController.
Please read the guidelines.
See LICENSE.
