hero

Lighthouse

GraphQL server for Laravel

Get Started →

📜 SDL First

Use the GraphQL Schema Definition Language to describe your data and add functionality through server-side directives.

❤ Laravel Friendly

Build a GraphQL server on top of an existing Laravel application. Maximize code reuse and work with concepts you already know.

⚡ Optimized for Eloquent

Lighthouse leverages your existing models and creates optimized database queries out of the box.

# Boilerplate free schema definition

Define your schema without any boilerplate by using the GraphQL Schema Definition Language.

type User {
  name: String!
  posts: [Post!]! @hasMany
}

type Post {
  title: String!
  author: User @belongsTo
}

type Query {
  me: User @auth
  posts: [Post!]! @paginate
}

type Mutation {
  createPost(
    title: String @rules(apply: ["required", "min:2"])
    content: String @rules(apply: ["required", "min:12"])
  ): Post @create
}

# Query just what you need

In a GraphQL query, the client can get all the data they need - and no more - all in a single request.

query PostsWithAuthor {
  posts {
    title
    author {
      name
    }
  }
}

# Get predictable results

A GraphQL server can tell clients about its schema, so they will always know exactly what they will get.

{
  "data": {
    "posts": [
      {
        "title": "Lighthouse rocks",
        "author": {
          "name": "Albert Einstein"
        }
      },
      {
        "title": "World peace achieved through GraphQL",
        "author": {
          "name": "New York Times"
        }
      }
    ]
  }
}