PHPackages                             hmennen90/laravel-graphql - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hmennen90/laravel-graphql

ActiveLibrary[API Development](/categories/api)

hmennen90/laravel-graphql
=========================

A hand-written GraphQL engine with first-class Laravel integration (code-first + SDL).

v1.10.0(1mo ago)01MITPHPPHP ^8.4CI passing

Since Jul 10Pushed 1mo agoCompare

[ Source](https://github.com/hmennen90/laravel-graphql)[ Packagist](https://packagist.org/packages/hmennen90/laravel-graphql)[ Docs](https://github.com/hmennen90/laravel-graphql)[ RSS](/packages/hmennen90-laravel-graphql/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (22)Versions (13)Used By (0)

laravel-graphql
===============

[](#laravel-graphql)

[![CI](https://github.com/hmennen90/laravel-graphql/actions/workflows/ci.yml/badge.svg)](https://github.com/hmennen90/laravel-graphql/actions/workflows/ci.yml)[![Latest Version](https://camo.githubusercontent.com/2c40ce8b0986fcdc0cd70416be69f3dbf100121fbe861bc567838ffe48100d1f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686d656e6e656e39302f6c61726176656c2d6772617068716c2e737667)](https://packagist.org/packages/hmennen90/laravel-graphql)[![PHP Version](https://camo.githubusercontent.com/b4c67800501eac0e446bc7132f652cd0de8863c6f6e5148f3bb1706824f26e7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f686d656e6e656e39302f6c61726176656c2d6772617068716c2e737667)](https://packagist.org/packages/hmennen90/laravel-graphql)[![Total Downloads](https://camo.githubusercontent.com/775208825ceea7d6c12be339182ed3d7e9f2157f44501b9a05fd67141d0d4ec2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686d656e6e656e39302f6c61726176656c2d6772617068716c2e737667)](https://packagist.org/packages/hmennen90/laravel-graphql)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

A **hand-written GraphQL engine** with first-class Laravel integration — no dependency on `webonyx/graphql-php`. Define your schema **code-first** (PHP), **schema-first** (SDL), **attribute-driven**, or mix all three; they compile to one internal schema.

> **Status:** in active development. APIs may change before the first stable release.

Key differentiator — single source of truth
-------------------------------------------

[](#key-differentiator--single-source-of-truth)

Unlike SDL-first stacks, you do **not** implement a type twice. There is no SDL type mirroring your Eloquent model plus a separate type/transformer class, and no directive DSL to keep in sync. Declare a type **once**; resolvers are plain PHP callables that read your models directly.

Features
--------

[](#features)

- Own lexer, parser, AST, type system, validator and executor (spec-driven).
- **Hybrid schema:** code-first, SDL, and PHP attributes — one internal schema.
- Built-in scalars (`Int`, `Float`, `String`, `Boolean`, `ID`) + custom scalars.
- Objects, interfaces, unions, enums, input objects, lists, non-null.
- Comprehensive validation, introspection (GraphiQL/Apollo tooling), `@oneOf`, `@specifiedBy`.
- Custom directives (runtime middleware **and** build-time SDL), SDL type extensions.
- **Eloquent directive layer** (`@all`, `@find`, `@paginate`, `@hasMany`, `@whereConditions`, `@orderBy`, `@create`/`@update`/`@delete`, `@search`, …) — available as **SDL directives and equivalent PHP attributes** (`#[All]`, `#[Paginate]`).
- Argument sanitisers &amp; validation: `@trim`, `@hash`, `@globalId`, `@rules`, `@validator`.
- **DataLoader** (N+1 batching), query **depth/complexity limits**.
- Laravel: HTTP endpoint, batching, middleware/auth, error masking, GraphiQL, file uploads, Automatic Persisted Queries, `@cacheControl` HTTP caching, Relay pagination, subscriptions (broadcasting, graphql-ws **+** SSE), **Apollo Federation**.
- PHP 8.4, PHPStan level 10, tested with `orchestra/testbench` + a GraphQL **spec conformance suite** (language, validation, execution, introspection), parser **fuzzing**and **Infection** mutation testing (engine core: 100% mutation coverage, ~79% MSI).

Requirements
------------

[](#requirements)

- PHP `^8.4`
- Laravel 11, 12 or 13 (for the Laravel integration; the engine itself is framework-agnostic)

Installation
------------

[](#installation)

```
composer require hmennen90/laravel-graphql
```

Publish the config (and optionally a starter schema):

```
php artisan vendor:publish --tag=graphql-config
```

---

Quick start (Laravel)
---------------------

[](#quick-start-laravel)

Create a schema provider:

```
