noh4ck/graphiql
noh4ck/graphiql provides a ready-to-use GraphiQL IDE for Laravel applications. Point it at your GraphQL endpoint, customize the route, and use the browser to run queries, test mutations, and explore schema documentation. A simple, lightweight way to debug and develop GraphQL APIs inside Laravel.
Install and reach the UI in three steps:
composer require noh4ck/graphiql
php artisan vendor:publish --provider="Noh4ck\GraphiQL\GraphiQLServiceProvider"
php artisan route:list | grep graphiql # confirm the route is registered
On Laravel 5.5+ the service provider is auto-discovered; on 5.4 and below add Noh4ck\GraphiQL\GraphiQLServiceProvider::class to config/app.php.
First use case: you already have a Laravel GraphQL endpoint wired up (this package is only the UI — it does not implement GraphQL itself). The typical pairing is folklore/graphql (or rebing/graphql-laravel). Once that endpoint responds at /graphql, visit http://your-app.test/graphiql, and you get the classic GraphiQL IDE: schema introspection on the left, query editor in the middle, JSON results on the right.
Where to look first:
config/graphiql.php after publishing — route path and middleware live here.src/ route definition to confirm which GraphQL URL the UI points at (it is baked into the served view).php artisan route:list — the fastest sanity check that the UI is reachable.If the page loads but queries fail, the problem is almost always the GraphQL endpoint, not this package.
Environment-gated exposure (recommended). The UI is an unauthenticated debugging tool by default. Lock it down:
// config/graphiql.php
return [
'route' => 'graphiql',
'middleware' => ['web', 'auth'], // or restrict via env below
];
Or keep it dev-only with a service provider boot() guard:
public function boot()
{
if (! app()->environment('local', 'staging')) {
abort(404);
}
}
Wrapping the route in auth is the simplest way to keep the IDE around on staging without leaking your schema to the public.
Pairing with your GraphQL layer. Point the IDE at whatever endpoint your backend exposes. With folklore/graphql the default is /graphql; with rebing/graphql-laravel it may be /graphql or a custom path depending on your config. If you changed the endpoint, you generally need to override the package's published view (see Gotchas) since the URL is set client-side in the GraphiQL <script>.
Day-to-day workflow. Treat it as your API scratchpad:
docs/ folder — the IDE gives you no history, so persistence is on you.X-Request-Id-style) if your middleware logs requests.Integration with feature tests. Don't test through the IDE route — test the underlying /graphql endpoint directly with Laravel's HTTP test client. The GraphiQL route is a UI convenience; asserting on it only verifies static HTML.
Replacing it when you upgrade. Because both this package and folklore/graphql are archived, plan the migration path now: lighthouse-php/lighthouse ships its own GraphiQL UI (/graphiql via its Playground/GraphiQL directives) and is actively maintained. That is the natural successor for any long-lived project.
POST requests. If the endpoint sits behind the web middleware group, CSRF will reject them. Ensure the GraphQL route is in the api group or explicitly CSRF-exempt; otherwise every query returns 419 and the UI looks broken.graphiql named route, or your GraphQL endpoint lives at the same path you configured, you'll get collisions. Check route:list first./graphiql render? → route/middleware. (2) does the network tab show a POST? → endpoint URL in the view. (3) is the POST 419/401/404? → CSRF/auth/REST path. (4) does the JSON come back an errors array? → now it's a schema resolver issue, unrelated to this package.php artisan vendor:publish --tag=views where supported) rather than editing vendor/, so the endpoint URL and GraphiQL JS version can be patched locally. This is also your escape hatch if the bundled GraphiQL asset is too old for your browser.'middleware' => ['auth'] in the config affects only the IDE page, not the GraphQL endpoint it calls — lock both or neither.fruitcake/laravel-cors configured for the GraphQL route, or the browser will block the POST even though curl works.How can I help you explore Laravel packages today?