lighthouse

A framework for serving GraphQL from Laravel

MIT License

Downloads
6.9M
Stars
3.3K
Committers
195

Bot releases are hidden (Show)

lighthouse -

Published by spawnia about 6 years ago

lighthouse -

Published by spawnia about 6 years ago

lighthouse -

Published by chrissm79 about 6 years ago

lighthouse - v2.2 Beta 1

Published by chrissm79 over 6 years ago

lighthouse -

Published by chrissm79 over 6 years ago

lighthouse - v2.2 Alpha 1

Published by chrissm79 over 6 years ago

lighthouse - v2.1 Release

Published by chrissm79 over 6 years ago

lighthouse - v2.1 Release Candidate

Published by chrissm79 over 6 years ago

Going to freeze updates for v2.1, all PRs going to master will be for v2.2 and bugfixes for v2.1 should be merged with this new branch.

lighthouse - GraphQL Security Directives

Published by chrissm79 over 6 years ago

Created @security directive which can be set on the Query type with the following options:

type Query @security(introspection: false, depth: 10, complexity: 100) {
    # ...
}

A new @complexity directive has been created which can be attached to fields to calculate complexity (default calculation provided for relationships):

type User {
    # default calculation
    posts: [Post!]! @hasMany @complexity

    # custom calculation
    posts: [Post!]! @hasMany @complexity(resolver: "App\\Http\\GraphQL\\Complexity::userPosts")
}

Read More: https://webonyx.github.io/graphql-php/security/

lighthouse - Handle subscription definition in schema

Published by chrissm79 over 6 years ago

lighthouse - Allow `relay` or `connection` as pagination type

Published by chrissm79 over 6 years ago

lighthouse - Allow `relay` or `connection` as pagination type

Published by chrissm79 over 6 years ago

lighthouse - Relay Cursor and Postgres Fixes

Published by chrissm79 over 6 years ago

lighthouse - Fix relay cursor

Published by chrissm79 over 6 years ago

lighthouse - Remove backticks in QueryBuilder (Postgres)

Published by chrissm79 over 6 years ago

lighthouse - Initial Lumen Support

Published by chrissm79 over 6 years ago

Thanks to the help of @4levels and @kikoseijo, Lumen has initial support! If you run into any problems please submit an issue!

lighthouse - Client Directives

Published by chrissm79 over 6 years ago

You can now define client side directives in your schema files. Some helper methods/traits will be provided in the future that you can use to help resolve those directives.

Server Side

# Server Side - Defines a client directive that can be applied to fields
directive @cache(key: String) on FIELD

# ...
type Query {
  foo: String
}

Client Side

query Foo {
  foo @cache("client-cache-key")
}
lighthouse - Include default eager loads

Published by chrissm79 over 6 years ago

If you're using the hasMany directive and you're connected model has default eager loading Lighthouse will now pull in those relations automatically.

For example, if you have a model:

class Post extends Model
{
    protected $with = ['comments'];
}

a schema like this:

type Post {
  author: [Comment!]! @hasMany
}

Lighthouse will automatically eager load the author relationship whenever a Post type is queried.

lighthouse - Eloquent Argument Filters

Published by chrissm79 over 6 years ago

Created @where, @whereBetween, @whereNotBetween, @eq, @notEq, @in, @notIn argument directives to filter queries.

type User {
  id: ID!
  name: String
  email: String
}

type Query {
  # filter users with an `id` in the provided array
  users(include: [Int] @in(key: "id")): [User!]!
    @paginate(model: "Tests\\\Utils\\\Models\\\User")
}

Until docs are released, check out the tests here.

lighthouse - Allow custom error formatting

Published by chrissm79 over 6 years ago

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register()
    {
        // ...

       // Register custom error formatting
        \GraphQL::error(function ($error, $e) {
            $previous = $e->getPrevious();

            if ($previous && $previous instanceof \Nuwave\Lighthouse\Support\Exceptions\ValidationError) {
                $error['status_code'] = 422;
            }

            return $error;
        });
    }
}