| home | true | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| title | Lighthouse - A framework for serving GraphQL from Laravel | |||||||||||||||
| heroImage | /logo.svg | |||||||||||||||
| actionText | Get Started → | |||||||||||||||
| actionLink | /latest/getting-started/installation | |||||||||||||||
| features |
|
|||||||||||||||
| footer | Made with ❤ by people |
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
}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
}
}
}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"
}
}
]
}
}