env('GRAPHQL_URL', env('APP_URL')), 'rate_limit' => (int) env('GRAPHQL_RATE_LIMIT', 80), 'route' => [ // The prefix for routes; do NOT use a leading slash! 'prefix' => env('GRAPHQL_PATH', '/'), // Also supported array syntax: `[\Rebing\GraphQL\GraphQLController::class, 'query']` 'controller' => Rebing\GraphQL\GraphQLController::class.'@query', // This middleware will apply to all schemas 'middleware' => [ // Set the serving context to graphql. SetServingGraphQL::class, // Rate limiting GraphQL to prevent abuse. RateLimitPerQuery::class, ], // Additional route group attributes // 'group_attributes' => ['guard' => 'api'] // 'group_attributes' => [ 'guard' => 'web', ], ], // The name of the default schema // Used when the route group is directly accessed 'default_schema' => 'v1', 'batching' => [ // Whether to support GraphQL batching or not. // See e.g. https://www.apollographql.com/blog/batching-client-graphql-queries-a685f5bcd41b/ // for pro and con 'enable' => true, ], // The schemas for query and/or mutation. It expects an array of schemas to provide // both the 'query' fields and the 'mutation' fields. // // Example: // // 'schemas' => [ // 'default' => [ // 'controller' => MyController::class . '@method', // 'query' => [ // App\GraphQL\Queries\UsersQuery::class, // ], // 'mutation' => [ // // ] // ], // 'user/me' => [ // 'query' => [ // App\GraphQL\Queries\MyProfileQuery::class, // ], // 'mutation' => [ // // ], // 'middleware' => ['auth'], // ], // ] // 'schemas' => [ 'v1' => V1Schema::class, ], // The global types available to all schemas. 'types' => [ // Pagination PaginationInfoType::class, ], // This callable will be passed the Error object for each errors GraphQL catch. // The method should return an array representing the error. // Typically: // [ // 'message' => '', // 'locations' => [] // ] 'error_formatter' => [Rebing\GraphQL\GraphQL::class, 'formatError'], /* * Custom Error Handling * * Expected handler signature is: function (array $errors, callable $formatter): array * * The default handler will pass exceptions to laravel Error Handling mechanism */ 'errors_handler' => [App\GraphQL\Handler\ErrorHandler::class, 'handleErrors'], /* * Options to limit the query complexity and depth. See the doc * @ https://webonyx.github.io/graphql-php/security * for details. Disabled by default. */ 'security' => [ 'query_max_complexity' => 0, // 250 in GraphQLServiceProvider 'query_max_depth' => 13, 'disable_introspection' => false, ], // Custom array 'pagination_values' => [ 'default_count' => 15, 'max_count' => 100, 'relation' => [ 'default_count' => 1000000, 'max_count' => null, ], ], /* * Reference \Rebing\GraphQL\Support\PaginationType::class */ 'pagination_type' => App\GraphQL\Schema\Types\Base\PaginationType::class, /* * Reference \Rebing\GraphQL\Support\SimplePaginationType::class */ 'simple_pagination_type' => Rebing\GraphQL\Support\SimplePaginationType::class, /* * Reference Rebing\GraphQL\Support\CursorPaginationType::class */ 'cursor_pagination_type' => Rebing\GraphQL\Support\CursorPaginationType::class, /* * Overrides the default field resolver * See http://webonyx.github.io/graphql-php/data-fetching/#default-field-resolver * * Example: * * ```php * 'defaultFieldResolver' => function ($root, $args, $context, $info) { * }, * ``` * or * ```php * 'defaultFieldResolver' => [SomeKlass::class, 'someMethod'], * ``` */ 'defaultFieldResolver' => null, /* * Any headers that will be added to the response returned by the default controller */ 'headers' => [], /* * Any JSON encoding options when returning a response from the default controller * See http://php.net/manual/function.json-encode.php for the full list of options */ 'json_encoding_options' => 0, /* * Automatic Persisted Queries (APQ) * See https://www.apollographql.com/docs/apollo-server/performance/apq/ * * Note 1: this requires the `AutomaticPersistedQueriesMiddleware` being enabled * * Note 2: even if APQ is disabled per configuration and, according to the "APQ specs" (see above), * to return a correct response in case it's not enabled, the middleware needs to be active. * Of course if you know you do not have a need for APQ, feel free to remove the middleware completely. */ 'apq' => [ // Enable/Disable APQ - See https://www.apollographql.com/docs/apollo-server/performance/apq/#disabling-apq 'enable' => env('GRAPHQL_APQ_ENABLE', false), // The cache driver used for APQ 'cache_driver' => env('GRAPHQL_APQ_CACHE_DRIVER', config('cache.default')), // The cache prefix 'cache_prefix' => config('cache.prefix').':graphql.apq', // The cache ttl in seconds - See https://www.apollographql.com/docs/apollo-server/performance/apq/#adjusting-cache-time-to-live-ttl 'cache_ttl' => 300, ], 'execution_middleware' => [ Rebing\GraphQL\Support\ExecutionMiddleware\ValidateOperationParamsMiddleware::class, // AutomaticPersistedQueriesMiddleware listed even if APQ is disabled, see the docs for the `'apq'` configuration Rebing\GraphQL\Support\ExecutionMiddleware\AutomaticPersistedQueriesMiddleware::class, Rebing\GraphQL\Support\ExecutionMiddleware\AddAuthUserContextValueMiddleware::class, // \Rebing\GraphQL\Support\ExecutionMiddleware\UnusedVariablesMiddleware::class, ], 'resolver_middleware_append' => null, ];