digiaonline / lumen-graphql
GraphQL module for the Laravel and Lumen PHP frameworks.
Installs: 7 839
Dependents: 0
Suggesters: 0
Security: 0
Stars: 24
Watchers: 13
Forks: 7
Open Issues: 4
Requires
- php: >=7.1
- digiaonline/json-helpers: ^1.0
- illuminate/console: ^5.5
- illuminate/support: ^5.5
- jalle19/laravel-lost-interfaces: ^1.0
- youshido/graphql: ^1.5
Requires (Dev)
- laravel/lumen-framework: ^5.5
- nordsoftware/lumen-newrelic: ^1.1
- phpstan/phpstan: ^0.10.3
- phpunit/phpunit: ^5.7
- vlucas/phpdotenv: ~2.2
Suggests
- nordsoftware/lumen-newrelic: Required to use the New Relic middleware (1.1.*).
README
GraphQL module for the Laravel and Lumen PHP frameworks.
Requirements
Usage
Installation
Run the following command to install the package through Composer:
composer require digiaonline/lumen-graphql
Configure
Copy 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
string
Schema class name, must be an instance ofYoushido\GraphQL\Schema\Schema
- type_resolver
string
Type resolver class name, must be an instance ofDigia\Lumen\GraphQL\Contracts\TypeResolverInterface
- processor
string
Optional processor class name, must be an instance ofYoushido\GraphQL\Execution\Processor
- enable_graphiql
bool
Whether or not the GraphiQL interface is enabled - graphiql_token
string
Token required for accessing the GraphiQL interface
Bootstrapping
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
.
Contributing
Please read the guidelines.
License
See LICENSE.