Overview of Laravel GraphQL features
masterLaravel GraphQL is a code-first integration for Laravel based on the webonyx/graphql-php implementation. Instead of using .graphql files, you define your schema entirely in PHP classes (types, queries, and mutations).
Key Features:
- Code-First Schema: Define types, queries, and mutations using PHP classes.
- Multiple Schemas: Support for multiple schemas, each with its own queries, mutations, types, HTTP middlewares, and GraphQL execution middlewares.
- Middleware Support: Includes HTTP middleware, GraphQL execution middleware, and custom GraphQL resolver middleware for specific queries/mutations.
- N+1 Prevention: Offers two strategies:
- Dataloaders: Uses deferred resolution to batch field loads.
- SelectFields (Optional): An external package that optimizes Eloquent
select()andwith()calls based on the GraphQL query.
- Privacy: Queries return types that can have custom privacy settings.
Note: This package does not support GraphQL subscriptions. For real-time push functionality, use Laravel broadcasting/WebSockets or a solution like Lighthouse.