PHPackages                             deinternetjongens/lighthouse-utils - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. deinternetjongens/lighthouse-utils

Abandoned → [nuwave/lighthouse](/?search=nuwave%2Flighthouse)Library[API Development](/categories/api)

deinternetjongens/lighthouse-utils
==================================

A Laravel Lighthouse addon with several utilities to automatically generate an awesome GraphQL API

0.2.0(7y ago)269162[4 issues](https://github.com/deInternetJongens/Lighthouse-Utils/issues)1MITPHPPHP &gt;=7.1

Since Jul 19Pushed 6y ago12 watchersCompare

[ Source](https://github.com/deInternetJongens/Lighthouse-Utils)[ Packagist](https://packagist.org/packages/deinternetjongens/lighthouse-utils)[ RSS](/packages/deinternetjongens-lighthouse-utils/feed)WikiDiscussions develop Synced 2d ago

READMEChangelog (5)Dependencies (5)Versions (10)Used By (1)

Lighthouse Utils (no longer maintained)
=======================================

[](#lighthouse-utils-no-longer-maintained)

[![Build Status](https://camo.githubusercontent.com/bcdc4e312792603548c9e87a9204a0eae3b91c54346aca287ce32e8f61848725/68747470733a2f2f7472617669732d63692e6f72672f6465496e7465726e65744a6f6e67656e732f4c69676874686f7573652d5574696c732e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/deInternetJongens/Lighthouse-Utils)[![Code Coverage](https://camo.githubusercontent.com/0ac45f56e93b57f7a2c3de963c9a25a1216b37acc509a129fca2cfec4a197f90/68747470733a2f2f636f6465636f762e696f2f67682f6465496e7465726e65744a6f6e67656e732f4c69676874686f7573652d5574696c732f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/deInternetJongens/Lighthouse-Utils)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a7df3ee615b4b08570b4b68f1adaad639a4b368202b7dc6d366fc40dbc4b9182/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465496e7465726e65744a6f6e67656e732f4c69676874686f7573652d5574696c732f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/deInternetJongens/Lighthouse-Utils/?branch=develop)[![Latest Unstable Version](https://camo.githubusercontent.com/204b355edf3586e395de2e1688b0476be569816ae3f861bb062d00d57aaad885/68747470733a2f2f706f7365722e707567782e6f72672f6465696e7465726e65746a6f6e67656e732f6c69676874686f7573652d7574696c732f762f756e737461626c65)](https://packagist.org/packages/deinternetjongens/lighthouse-utils)

This package can generate queries for the [Lighthouse GraphQL library](https://github.com/nuwave/lighthouse). This is not a standalone package, so Lighthouse is listed as a dependency.

To generate queries, all you need to do is define a couple of [GraphQL Types](https://lighthouse-php.netlify.com/docs/schema.html) and run the generate command. Scroll down to 'Schema' to learn more.

We also include a couple of [Directives](https://lighthouse-php.netlify.com/docs/directives-queries.html) and [Scalar types](https://lighthouse-php.netlify.com/docs/schema.html). More about that later on.

Installation
------------

[](#installation)

Install via composer

```
composer require deinternetjongens/lighthouse-utils
```

Alternatively, you can try the example installation below.

### Example installation

[](#example-installation)

An example installation is available at:

### Register Service Provider

[](#register-service-provider)

**Note! This and next step are optional if you use laravel&gt;=5.5 with package auto discovery feature.**

Add service provider to `config/app.php` in `providers` section

```
deinternetjongens\LighthouseUtils\ServiceProvider::class,
```

### Register Facade

[](#register-facade)

Register package facade in `config/app.php` in `aliases` section

```
deinternetjongens\LighthouseUtils\Facades\LighthouseUtils::class,
```

### Publish Configuration File

[](#publish-configuration-file)

```
php artisan vendor:publish --provider="DeInternetJongens\LighthouseUtils\ServiceProvider" --tag="config"
```

Contributing
------------

[](#contributing)

Before committing, please run `./automate.sh`

This script will run all code style checks and phpunit tests. Fix all errors before opening a pull request.

Usage
-----

[](#usage)

This package uses Laravel Auto Discovery to register itself with your application. It exposes a GraphQL interface interface on the `/graphql` route.

To get started, run the following command in your Laravel application:

```
php artisan vendor:publish --provider="Nuwave\Lighthouse\Providers\LighthouseServiceProvider"
php artisan vendor:publish --provider="DeInternetJongens\LighthouseUtils\ServiceProvider" --tag="migrations"
php artisan migrate
```

A config file will be generated: `config/lighthouse.php`. You can change these values if you want.

Schema generation
-----------------

[](#schema-generation)

Define your GraphQL schema by adding Types, Queries and Mutations in `app/GraphQL/Types`, `app/GraphQL/Queries` and `app/GraphQL/Mutations` directories. If you want to change these paths, publish the config file for this package and change the paths there.

Currently this package only supports custom Types, Queries and Mutations are ignored. You can define your custom types and run the command below to auto-generate queries and mutations for those types. In the future it will be possible to add custom queries and mutations to the above directories. These will then also be used in the generated schema.

For more information on schemas and basic Lighthouse usage, check [the Lighthouse docs](https://lighthouse-php.netlify.com/)

To generate your `schema.graphql` file, run the following command:

```
php artisan lighthouse-utils:generate-schema
```

The schema will be generated to the path as defined in the Lighthouse config, `lighthouse.schema.register`

Custom Queries and Mutations
----------------------------

[](#custom-queries-and-mutations)

It might happen that you need a custom query or mutation beside the generated schema. In this package you have the ability to add custom queries and mutations by creating `.graphql` files in the default directories `app/GraphQL/Queries` and `app/GraphQL/Mutations` *(These directories are adjustable by editing the `config/lighthouse.php` file)*

Take for example a custom query to retrieve an instance of a model:

```
type Query{
    customQuery(id: ID! @eq): Model! @find(model: "Model")
}
```

This query will be parsed after running the schema generation command and will be added to the Query section of the `schema.graphql`

### Scalar types

[](#scalar-types)

Currently two scalar types are included. More about scalar type usage can be [found here](https://lighthouse-php.netlify.com/docs/schema-scalars.html).

#### Date

[](#date)

A date string with format Y-m-d. Example: "2018-01-01"

`scalar Date @scalar(class: "DeInternetJongens\\LighthouseUtils\\Schema\\Scalars\\Date")`

#### DateTimeTZ

[](#datetimetz)

A date string with format Y-m-d H:i:s+P. Example: "2018-01-01 13:00:00+00:00"

`scalar DateTimeTz @scalar(class: "DeInternetJongens\\LighthouseUtils\\Schema\\Scalars\\DateTimeTz")`

#### PostalCodeNl

[](#postalcodenl)

A postal code as valid for The Netherlands, format 1111aa. Example: "7311SZ"

#### Email

[](#email)

An RFC 5321 compliant e-mail

#### FullTextSearch

[](#fulltextsearch)

Indicates that a field searches through multiple fields. To use this scalar, you need to add a scope on your model `scopeFullTextSearch`. Example:

```
public function scopeFullTextSearch(Builder $builder, $value)
{
    return $builder->whereRaw("column_one % ? OR column_two % ?", [$value, $value])
        ->orderByRaw('column_two  ?', [$value]);
}
```

In the scope you can basically define whatever kind of query you want.

### Directives

[](#directives)

To run more advanced queries, a couple of directives are included. These are automatically registered with Lighthouse, so you can use them at your own discretion.

Currently these directives are included:

- contains
- ends\_with
- gte
- gt
- lte
- lt
- in (comma seperated string)
- not\_contains
- not\_ends\_with
- not
- not\_in (comma seperated string)
- not\_starts\_with
- starts\_with
- fullTextSearch

### Migrations

[](#migrations)

This package stores the generated schema in the database, so the schema is available outside the `schema.graphql` and can be used to sync permission. Publish the migration and migrate the database.

```
php artisan vendor:publish --provider="DeInternetJongens\LighthouseUtils\ServiceProvider" --tag="migrations"
php artisan migrate
```

### Authorization

[](#authorization)

To protect your queries and migrations from unauthorized users, you can enable the Authorization feature. To enable authorization, make sure you have published the config for this package and add the following line to your .env file:

`LIGHTHOUSE_UTILS_AUTHORIZATION=true`

When a schema is generated the event `DeInternetJongens\LighthouseUtils\Events\GraphQLSchemaGenerated` will be fired. In your application you can listen for this event to sync the generated permissions with your application. The event has a `schema` variable with the generated schema.

The generated queries and their corresponding permissions will also be persisted to your database to the `graphql_schema` table. An Eloquent model for this table is included with this package.

###  Health Score

31

↑

LowBetter than 68% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Total

5

Last Release

2794d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ab892324187874b808c0bd037ff12f74fcb3257f0cf8d9723bbd30768d482ac?d=identicon)[DIJ](/maintainers/DIJ)

![](https://www.gravatar.com/avatar/a5d517f8ada3967b001394a63b734357f85d0517c05905e3c89d005ee852d015?d=identicon)[maarten00](/maintainers/maarten00)

---

Top Contributors

[![kevinpijning](https://avatars.githubusercontent.com/u/2886081?v=4)](https://github.com/kevinpijning "kevinpijning (18 commits)")[![maarten00](https://avatars.githubusercontent.com/u/1579711?v=4)](https://github.com/maarten00 "maarten00 (3 commits)")[![wotta](https://avatars.githubusercontent.com/u/13332240?v=4)](https://github.com/wotta "wotta (2 commits)")[![CrazyICT](https://avatars.githubusercontent.com/u/7723270?v=4)](https://github.com/CrazyICT "CrazyICT (1 commits)")[![jordyvandomselaar](https://avatars.githubusercontent.com/u/12712484?v=4)](https://github.com/jordyvandomselaar "jordyvandomselaar (1 commits)")

---

Tags

eloquentgraphqlgraphql-serverlaravelrelaygraphqlgeneratorslighthouse

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/deinternetjongens-lighthouse-utils/health.svg)

```
[![Health](https://phpackages.com/badges/deinternetjongens-lighthouse-utils/health.svg)](https://phpackages.com/packages/deinternetjongens-lighthouse-utils)
```

###  Alternatives

[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k10.7M93](/packages/nuwave-lighthouse)[joselfonseca/lighthouse-graphql-passport-auth

Add GraphQL types and mutations for login and recover password functionalities

234769.9k1](/packages/joselfonseca-lighthouse-graphql-passport-auth)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[yakovenko/laravel-lighthouse-graphql-multi-schema

A Laravel package that provides multi-schema support for Lighthouse GraphQL.

1562.5k](/packages/yakovenko-laravel-lighthouse-graphql-multi-schema)[thecodingmachine/graphqlite-laravel

A Laravel service provider package to help you get started with GraphQLite in Laravel.

1852.3k1](/packages/thecodingmachine-graphqlite-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
