rebing/graphql-laravel
Code-first GraphQL integration for Laravel built on webonyx/graphql-php. Define schemas, types, queries and mutations in PHP with support for multiple schemas, middleware, resolver middleware, privacy rules, and n+1 avoidance via dataloaders or SelectFields.
ResolverParameterInjector.SelectFields extracted to a separate package for granular control).SelectFields core functionality without wanting to manage a separate package (now optional).Privacy::validate() signature shifts, WrapType interface requirements).SelectFields allows opt-in optimization (install separately) without bloating core dependencies.max_batch_size) prevent abuse in high-traffic APIs.ResolverParameterInjector) enable framework-agnostic extensions (e.g., logging, caching).WrapType interface) force alignment with modern Laravel practices (e.g., interfaces over traits).query_max_depth/max_complexity.SelectFields to the standalone package (if used) and update resolver signatures.ResolverParameterInjector for cross-cutting concerns (e.g., audit logging, rate limiting).WrapType interface on custom pagination/types to maintain SelectFields compatibility.Closure auto-injection) in favor of explicit DI.ResolverParameterInjector for domain-specific logic (e.g., tenant isolation).| Use Case | Why This Package (10.0.0-RC4)? |
|---|---|
| Regulated APIs (HIPAA/GDPR) | Default security hardening and OpenTelemetry tracing simplify compliance audits. |
| Microservices with Laravel | Modular SelectFields and resolver DI enable consistent query optimization across services. |
| High-Traffic Public APIs | Query depth/complexity limits and batch size controls mitigate abuse. |
| Legacy System Modernization | Breaking changes force alignment with modern Laravel practices (e.g., interfaces over traits). |
| Observability-Driven Dev | OpenTelemetry integration correlates GraphQL queries with Laravel’s ecosystem (e.g., queues). |
SelectFields split, Privacy::validate() signature).SelectFields separately.WrapType).SelectFields now requires a separate package).WrapType interface, Privacy::validate()) require significant refactoring."Upgrade to GraphQL 10.0 for Enterprise-Grade Security and Observability"
rebing/graphql-laravel 10.0 delivers:
SelectFields reduces database load, lowering cloud costs.SelectFields to the standalone package and adopt resolver DI."GraphQL 10.0: Security, Observability, and Extensibility"
ResolverParameterInjector enables framework-agnostic resolver logic (e.g., caching, logging).SelectFields extracted to a separate package for granular control.SelectFields: Now requires rebing/graphql-laravel-select-fields (update resolvers to remove auto-injection).Privacy::validate(): Signature changed ($fieldArgs instead of $queryArgs).WrapType interface: Custom pagination/types must implement this for SelectFields compatibility.composer require rebing/graphql-laravel-select-fields.Closure auto-injection with explicit DI."GraphQL 10.0: What’s Changed and Why It Matters"
@graphql attributes:
use Rebing\GraphQL\Support\Facades\GraphQL;
GraphQL::addTracingMiddleware(new \OpenTelemetry\Contrib\GraphQL\TracingMiddleware());
Field::registerParameterInjector(MyInjector::class);
SelectFields: Install separately and update resolvers:
How can I help you explore Laravel packages today?