nielsjanssen / laravel-discovery-graphql
Rebing GraphQL integration for laravel-discovery
Package info
github.com/NielsJanssen/laravel-discovery-graphql
pkg:composer/nielsjanssen/laravel-discovery-graphql
Requires
- php: ^8.5
- nielsjanssen/laravel-discovery: ^1.0
- rebing/graphql-laravel: ^10.0
- tempest/discovery: ^3.10
Requires (Dev)
None
Suggests
- nielsjanssen/laravel-validation: Validate #[Query]/#[Mutation] parameters with attributes (#[Min], #[Email], ...)
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-12 15:16:04 UTC
README
Note
This is a read-only split mirror of the laravel-discovery monorepo. Please open issues and pull requests there.
laravel-discovery-graphql
Register Rebing GraphQL queries and mutations from attributes. A method
carrying #[Query] or #[Mutation] becomes a field in your schema, with its arguments taken from the method signature.
use NielsJanssen\Laravel\Discovery\RebingGraphQL\Arg; use NielsJanssen\Laravel\Discovery\RebingGraphQL\Authorize; use NielsJanssen\Laravel\Discovery\RebingGraphQL\Query; class Inventory { #[Query(type: 'Product')] public function product(#[Arg('id')] #[Authorize('view')] Product $product): Product { return $product; } }
The id argument resolves to the model, the view policy runs before the resolver, and the field appears in your
schema as product(id: ID!): Product!.
Requirements
- PHP 8.5+
- Laravel 13+
rebing/graphql-laravel^10.0nielsjanssen/laravel-discovery^1.0
Installation
composer require nielsjanssen/laravel-discovery-graphql
The service provider registers itself through Laravel's package discovery.
Documentation
- GraphQL: queries, mutations, arguments, model binding, schemas, pagination, and sorting.
- GraphQL authorization:
#[Authorize], custom gates, and authorizing a bound model. - GraphQL argument validation and hydration: validating arguments and hydrating value objects, and the hooks for wiring in your own library.
- Full documentation for the rest of the monorepo.