Artisan Commands

Lighthouse provides some convenient artisan commands. All of them are namespaced under lighthouse.


Clear the cache for the GraphQL AST.

php artisan lighthouse:clear-cache


Create a schema containing all server-side directives. This will allow some IDEs to do code completion in your GraphQL-schema.

php artisan lighthouse:ide-helper 


Gather all schema directive definitions and write them to a file.

php artisan lighthouse:ide-helper


Create a class for a GraphQL interface type.

php artisan lighthouse:interface <name>


Create a class for a single field on the root Mutation type.

php artisan lighthouse:mutation <name>

Compile the final GraphQL schema and print the result.

php artisan lighthouse:print-schema

This can be quite useful, as the root .graphql files do not necessarily contains the whole schema. Schema imports, native PHP types and schema manipulation may influence the final schema.

Use the -W / --write option to output the schema to the default file storage (usually storage/app) as lighthouse-schema.graphql.


Create a class for a single field on the root Query type.

php artisan lighthouse:query <name>


Create a class for a GraphQL scalar type.

php artisan lighthouse:scalar <name>


Create a class for a single field on the root Subscription type.

php artisan lighthouse:subscription <name>


Create a class for a GraphQL union type.

php artisan lighthouse:union <name>


Validate the GraphQL schema definition.

php artisan lighthouse:validate-schema