PHPackages                             mll-lab/laravel-graphiql - 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. mll-lab/laravel-graphiql

ActiveLibrary[API Development](/categories/api)

mll-lab/laravel-graphiql
========================

Easily integrate GraphiQL into your Laravel project

v4.1.0(2mo ago)683.2M—1.4%198MITPHPPHP ^8CI passing

Since Aug 26Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/mll-lab/laravel-graphiql)[ Packagist](https://packagist.org/packages/mll-lab/laravel-graphiql)[ RSS](/packages/mll-lab-laravel-graphiql/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (24)Versions (27)Used By (8)

Laravel GraphiQL
================

[](#laravel-graphiql)

A thin wrapper for serving [the GraphiQL UI](https://github.com/graphql/graphiql/tree/main/packages/graphiql) from Laravel

[![GitHub license](https://camo.githubusercontent.com/36d16e6d88684d510158f73bd7ae099872fd3347bfc4a10b0a27bc89e089bee8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6c6c2d6c61622f6c61726176656c2d677261706869716c2e737667)](https://github.com/mll-lab/laravel-graphqil/blob/master/LICENSE)[![Packagist](https://camo.githubusercontent.com/ca506c685ba2810059a7667e82bcb2dddd1fd3f793cf167be703cc77ef9465d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6c6c2d6c61622f6c61726176656c2d677261706869716c2e737667)](https://packagist.org/packages/mll-lab/laravel-graphqil)[![Packagist](https://camo.githubusercontent.com/e11c9344ba961ec594cc113494be6d820416409abe340f3b41249baeec14e431/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6c6c2d6c61622f6c61726176656c2d677261706869716c2e737667)](https://packagist.org/packages/mll-lab/laravel-graphqil)

[![Screenshot of GraphiQL with Doc Explorer Open](https://raw.githubusercontent.com/graphql/graphiql/main/packages/graphiql/resources/graphiql.png)](https://raw.githubusercontent.com/graphql/graphiql/main/packages/graphiql/resources/graphiql.png)

> **Please note**: This is a UI for testing and exploring your schema and does not include a GraphQL server implementation. To serve a GraphQL API from Laravel, we recommend [nuwave/lighthouse](https://github.com/nuwave/lighthouse).

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

[](#installation)

Install the package via [composer](https://getcomposer.org):

```
composer require mll-lab/laravel-graphiql
```

Due to [Laravel package discovery](https://laravel.com/docs/packages#package-discovery), this package will automatically register and is then ready to use without configuration.

If you are using Lumen, register the service provider in `bootstrap/app.php`

```
$app->register(MLL\GraphiQL\GraphiQLServiceProvider::class);
```

Upgrade Guide
-------------

[](#upgrade-guide)

When upgrading between major versions, consider [`UPGRADE.md`](UPGRADE.md).

Configuration
-------------

[](#configuration)

By default, the GraphiQL UI is reachable at `/graphiql` and assumes a running GraphQL endpoint at `/graphql`. To change those defaults, publish the configuration with the following command:

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

You will find the configuration file at `config/graphiql.php`.

### Lumen

[](#lumen)

If you are using Lumen, copy [src/graphiql.php](src/graphiql.php) to `config/graphiql.php` manually. Then load the configuration in your `boostrap/app.php`:

```
$app->configure('graphiql');
```

### HTTPS behind proxy

[](#https-behind-proxy)

If your application sits behind a proxy which resolves https, the generated URL for the endpoint might not use `https://`. This may cause the GraphiQL UI to not work by default. To solve this, configure your `TrustProxies` middleware to contain `\Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR` in `$headers`.

Customization
-------------

[](#customization)

To customize the GraphiQL UI even further, publish the view:

```
php artisan vendor:publish --tag=graphiql-view
```

You can use that for all kinds of customization.

### Change settings of the GraphiQL UI instance

[](#change-settings-of-the-graphiql-ui-instance)

Add extra props in the call to `React.createElement(GraphiQL, ...)` in the published view.

```
React.createElement(GraphiQL, {
  ...,
  // See https://github.com/graphql/graphiql/tree/main/packages/graphiql#props for available settings
});
```

### Configure session authentication

[](#configure-session-authentication)

Session-based authentication can be used with [Laravel Sanctum](https://laravel.com/docs/sanctum). If you use GraphQL through sessions and CSRF, add the following to the `` in the published view:

```
+
```

Modify the GraphiQL props as follows:

```
const fetcher = GraphiQL.createFetcher({
    url: '{{ $url }}',
    subscriptionUrl: '{{ $subscriptionUrl }}',
+   headers: {
+       'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
+   },
});
```

Make sure your route includes the `web` middleware group in `config/graphiql.php`:

```
    'routes' => [
        '/graphiql' => [
            'name' => 'graphiql',
+           'middleware' => ['web']
        ],
    ],
```

Local assets
------------

[](#local-assets)

To serve the assets from your own server, download them with:

```
php artisan graphiql:download-assets
```

This puts the necessary CSS, JS and Favicon into your `public` directory. If you have the assets downloaded, they will be used instead of the online version from the CDN.

Security
--------

[](#security)

If you do not want to enable the GraphiQL UI in production, you can disable it in the config file. The easiest way is to set the environment variable `GRAPHIQL_ENABLED=false`.

If you want to protect the route to the GraphiQL UI, you can add custom middleware in the config file.

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance88

Actively maintained with recent releases

Popularity57

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~52 days

Recently: every ~79 days

Total

26

Last Release

62d ago

Major Versions

v1.2.2 → v2.0.02023-04-13

v2.0.3 → v3.0.02023-05-17

v3.3.3 → v4.0.02025-05-07

v3.3.4 → v4.1.02026-03-18

PHP version history (2 changes)v1.0.0PHP ^7.1 || ^8

v3.0.0PHP ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ff5d1af2c0f601f7ed7e75e15be0aa4c062149b57fd5aace4e44cc37b8b7a40?d=identicon)[spawnia](/maintainers/spawnia)

---

Top Contributors

[![spawnia](https://avatars.githubusercontent.com/u/12158000?v=4)](https://github.com/spawnia "spawnia (54 commits)")[![hschaefler](https://avatars.githubusercontent.com/u/91871854?v=4)](https://github.com/hschaefler "hschaefler (1 commits)")[![Kyrch](https://avatars.githubusercontent.com/u/66730850?v=4)](https://github.com/Kyrch "Kyrch (1 commits)")[![mfn](https://avatars.githubusercontent.com/u/87493?v=4)](https://github.com/mfn "mfn (1 commits)")[![mostafa-rz](https://avatars.githubusercontent.com/u/71334549?v=4)](https://github.com/mostafa-rz "mostafa-rz (1 commits)")[![muba00](https://avatars.githubusercontent.com/u/11701997?v=4)](https://github.com/muba00 "muba00 (1 commits)")[![TheMhv](https://avatars.githubusercontent.com/u/25031483?v=4)](https://github.com/TheMhv "TheMhv (1 commits)")[![GeoSot](https://avatars.githubusercontent.com/u/22406063?v=4)](https://github.com/GeoSot "GeoSot (1 commits)")[![Yannick-Bruening](https://avatars.githubusercontent.com/u/69695342?v=4)](https://github.com/Yannick-Bruening "Yannick-Bruening (1 commits)")

---

Tags

graphiqlgraphqllaravellaravelgraphqlgraphiql

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mll-lab-laravel-graphiql/health.svg)

```
[![Health](https://phpackages.com/badges/mll-lab-laravel-graphiql/health.svg)](https://phpackages.com/packages/mll-lab-laravel-graphiql)
```

###  Alternatives

[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k10.7M93](/packages/nuwave-lighthouse)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[neuron-core/neuron-laravel

Official Neuron AI Laravel SDK.

10710.0k](/packages/neuron-core-neuron-laravel)[thecodingmachine/graphqlite-laravel

A Laravel service provider package to help you get started with GraphQLite in Laravel.

1852.3k1](/packages/thecodingmachine-graphqlite-laravel)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
