Lighthouse

GraphQL server for Laravel

Get Started →

Lighthouse

GraphQL Server for Laravel

Lighthouse is a PHP package that allows you to serve a GraphQL endpoint from your Laravel application. It greatly reduces the boilerplate required to create a schema, integrates well with any Laravel project, and is highly customizable giving you full control over your data.

Rapid GraphQL Development with Laravel

Lighthouse enables schema-first development by allowing you to use the native Schema Definition Language to describe your data. Leverage server-side directives to add functionality and bring your schema to life.

With nothing more than this schema file (along w/ Eloquent models and migrations set up), you have a fully functional GraphQL server with no additional code! But don't worry, you can extend Lighthouse to fit just about any data requirements.

The docs will walk you through what directives are available, how to create your own directives and how to create your own resolvers.

Get Started
type User {
  id: ID!
  name: String!
  email: String!
  posts: [Post]! @hasMany
}
type Post {
  title: String!
  content: String!
  author: User! @belongsTo
}
type Query {
  me: User @auth
}

Rapid GraphQL Development

Fully customizable to fit your data requirements.

Schema First

Lighthouse allows you to use the native Schema Definition Language to describe your data. Leverage server-side directives to add functionality and bring your schema to life.

Read More

Laravel Friendly

Lighthouse integrates with your Laravel application without the need to re-write your entire domain. Just build a GraphQL schema on top of your current logic and start querying!

Read More

Optimized for Eloquent

Eloquent is an extremely powerful ORM. Lighthouse leverages your current model relationships and creates optimized database queries.

Read More
type Query {
  me: User @auth
  posts: [Post!]! @paginate(model: "User")
}
type Mutation {
  createPost(
    title: String! @validate(rules: ["min:2"])
    content: String! @validate(rules: ["min:12"])
  ): Post
    # Autofill a new post model with the
    # arguments from the mutation.
    @create(model: "Post")
    # Inject the authenticated user's "id"
    # into the Post's "user_id" column.
    @inject(context: "user.id", attr: "user_id")
    # Fire an event w/ the newly created model.
    @event(fire: "App\Events\PostCreated")
}

Laravel & GraphQL

Lighthouse dramatically reduces the amount of boilerplate needed to get a GraphQL project up and running. Many of the familiar concepts from Laravel are converted into Lighthouse directives, so you can reuse existing logic and work the way you are used to.

If you already have your models and migrations set up, it only takes minutes to get up and running with Lighthouse. You only need to define a schema to have a fully functional GraphQL server with no additional code.

But don't worry, you can extend Lighthouse to fit just about any data requirements. The docs will walk you through what directives are available, how to create your own directives and how to create your own resolvers.

Read the Docs