Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Graphql Laravel

Graphql Laravel Laravel Package

rebing/graphql-laravel

Code-first GraphQL integration for Laravel built on webonyx/graphql-php. Define schema in PHP (types, queries, mutations), support multiple schemas with per-schema middleware, resolver middleware, privacy rules, and data loading to avoid N+1 (dataloaders/SelectFields).

View on GitHub
Deep Wiki
Context7

Laravel wrapper for Facebook's GraphQL

Frequently asked questions about Graphql Laravel
How do I install and set up rebing/graphql-laravel in a Laravel 12/13 project?
Run `composer require rebing/graphql-laravel` and publish the config with `php artisan vendor:publish --provider="Rebing\GraphQL\GraphQLServiceProvider"`. The package integrates seamlessly with Laravel’s service container, requiring no additional bootstrapping for basic use. Follow the [installation guide](https://github.com/rebing/graphql-laravel#installation) for artisan commands like `make:graphql:type` to generate schema classes.
Can I use multiple GraphQL schemas in the same Laravel app (e.g., admin vs. public API)?
Yes, the package supports **multiple schemas** with isolated queries, mutations, and middleware. Configure them in `config/graphql.php` under the `schemas` key. Each schema can have its own HTTP routes, execution middleware, and privacy rules, making it ideal for multi-tenancy or role-based APIs.
How does rebing/graphql-laravel handle the N+1 query problem in Eloquent relationships?
Use **Dataloaders** (built-in) to batch and cache database queries, or install the optional `rebing/graphql-laravel-select-fields` package to optimize Eloquent `select()` and `with()` calls based on GraphQL field requests. Both strategies reduce over-fetching and improve performance for complex queries.
What Laravel versions does rebing/graphql-laravel support, and are there breaking changes?
The package is actively maintained for **Laravel 10, 11, and 12/13**. Breaking changes are documented in the [changelog](https://github.com/rebing/graphql-laravel/blob/master/CHANGELOG.md), with a focus on backward compatibility. Always check the `composer.json` constraints for your Laravel version.
How do I secure GraphQL endpoints in production (e.g., disable introspection, limit query depth)?
Introspection is **disabled by default** in production. Enable it only for development via `config/graphql.php` (`introspection.enabled`). Set query depth/complexity limits in middleware (e.g., `Rebing\GraphQL\Middleware\QueryDepthMiddleware`) to prevent abuse. Use Laravel’s built-in auth middleware for route-level security.
Can I integrate Laravel validation rules (e.g., `required`, `email`) with GraphQL input arguments?
Yes, the package supports **native Laravel validation** for GraphQL input types. Define validation rules in your resolver classes using `use Illuminate\Support\Facades\Validator` or leverage the `@validate` directive. This reduces boilerplate and ensures consistency with your existing Laravel validation logic.
Does rebing/graphql-laravel support GraphQL subscriptions (real-time updates)?
No, this package **does not support subscriptions**. For real-time features, consider alternatives like [Lighthouse](https://lighthouse-php.com/) or implement subscriptions separately using Laravel Echo + Pusher. The package focuses on queries and mutations with optimized performance.
How do I add custom scalars (e.g., UUID, JSON) to my GraphQL schema?
Custom scalars require extending `GraphQL\Type\Definition\ScalarType` and registering them in your schema’s `register()` method. The package provides utilities for common types (e.g., `Rebing\GraphQL\Type\UUIDType`), but custom implementations are needed for niche use cases. Refer to the [custom scalars section](https://github.com/rebing/graphql-laravel#custom-scalars) in the docs.
What are the performance implications of using resolver middleware vs. execution middleware?
Execution middleware (e.g., auth, logging) runs **once per request**, while resolver middleware targets **individual fields**. Use execution middleware for cross-cutting concerns (e.g., rate limiting) and resolver middleware for field-specific logic (e.g., caching). Overuse of resolver middleware can impact performance, so benchmark critical paths.
Are there alternatives to rebing/graphql-laravel for Laravel GraphQL, and how do they compare?
Alternatives include **Lighthouse** (supports subscriptions but uses SDL schema files) and **GraphQLite** (simpler but less feature-rich). Rebing’s package stands out for its **code-first PHP approach**, multiple schemas, and deep Laravel integration (e.g., Eloquent, validation). Choose based on whether you prefer schema-as-code or SDL files and need for subscriptions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony