PHPackages                             jbernavaprah/lighthouse-translation - 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. jbernavaprah/lighthouse-translation

ActiveLibrary[API Development](/categories/api)

jbernavaprah/lighthouse-translation
===================================

Translation support for Laravel Lighthouse

v1.0.1(3y ago)1252MITPHPPHP ^8.1

Since May 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jBernavaPrah/lighthouse-translation)[ Packagist](https://packagist.org/packages/jbernavaprah/lighthouse-translation)[ RSS](/packages/jbernavaprah-lighthouse-translation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (13)Versions (3)Used By (0)

Lighthouse Translation
======================

[](#lighthouse-translation)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Tests Action Status](https://camo.githubusercontent.com/19b4598f7f4544029b47acea0a685d88654f3054d8e35a7f32ebd2ad04adfdae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6a4265726e617661507261682f6c69676874686f7573652d7472616e736c6174696f6e2f54657374733f6c6162656c3d7465737473)](https://github.com/jBernavaPrah/lighthouse-translation/actions?query=workflow%3Arun-tests+branch%3Amain)[![Coverage Status](https://camo.githubusercontent.com/33a93b183a9c92f2a80d6e3c3b244afa3999e313b466271ff6242d40cb52ed1e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6a4265726e617661507261682f6c69676874686f7573652d7472616e736c6174696f6e2f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/jBernavaPrah/lighthouse-translation?branch=main)[![PHPStan](https://camo.githubusercontent.com/441b5874ce4df0a2defc892979c96c46889b69cb32119d04f0b48626349f8bc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/phpstan/phpstan)[![Latest Version on Packagist](https://camo.githubusercontent.com/a34c77001be21f85745e6eeed51e7fc74af0f7c5ceca05668f3aa1342f0ec551/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6265726e617661707261682f6c69676874686f7573652d7472616e736c6174696f6e3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jBernavaPrah/lighthouse-translation)[![Total Downloads](https://camo.githubusercontent.com/0c5db6fb55877ec9fcaa03dc75168d372e696ce0d7ad28c07522d1d723d5a07b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a4265726e617661507261682f6c69676874686f7573652d7472616e736c6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jBernavaPrah/lighthouse-translation)

### Is not PRODUCTION READY.

[](#is-not-production-ready)

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)

Requirements
------------

[](#requirements)

- [laravel/laravel:^9.0](https://github.com/laravel/laravel)
- [nuwave/lighthouse:^5.5](https://github.com/nuwave/lighthouse)

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

[](#installation)

#### 1. Install using composer:

[](#1-install-using-composer)

```
composer require jBernavaPrah/lighthouse-translation
```

#### 2. UseTranslation

[](#2-usetranslation)

Apply the `JBernavaPrah\Translation\UseTranslation` trait to your models.

```
use JBernavaPrah\UseTranslation ;
use Illuminate\Database\Eloquent\Model;

/**
 * @property \JBernavaPrah\LighthouseTranslation\Translate $name
 *
 */
class Item extends Model
{
    use UseTranslation;

    public function translationColumns(): array{
        return ["name"]
    }

}
```

#### 3. Declare field type as `Translate` on GraphQL schema

[](#3-declare-field-type-as-translate-on-graphql-schema)

```
type Item {

    name: Translate!

    # ...

}
```

Usage
-----

[](#usage)

### Enable Translation

[](#enable-translation)

The directive `localize` accepts as a parameter the lang to use to return the localized data.

If is not founded on the column, null is returned.

```
query {
    item(id: 1) @localize(lang: "en") {
        name {
            ...on Localized{
                lang
                text
            }
        }
    }
}
```

In case the directive is not used on that query/mutation, the RawTranslation type is returned.

```
query {
    item(id: 1) {
        name {
            ... on RawTranslation {
                data {
                    lang
                    text
                }
            }
        }
    }
}
```

### Credits:

[](#credits)

A lot of ideas came thanks to [daniel-de-wit/lighthouse-sanctum](https://github.com/daniel-de-wit/lighthouse-sanctum). Big thanks to him and his beautiful code!
Also the authors of [nuwave/lighthouse](https://github.com/nuwave/lighthouse) did a great job on the documentation and code.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~22 days

Total

2

Last Release

1422d ago

### Community

Maintainers

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

---

Top Contributors

[![jBernavaPrah](https://avatars.githubusercontent.com/u/11057215?v=4)](https://github.com/jBernavaPrah "jBernavaPrah (11 commits)")

---

Tags

laravelgraphqllaravel-graphqllighthouse-phplighthouse-translation

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/jbernavaprah-lighthouse-translation/health.svg)

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

###  Alternatives

[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k10.7M93](/packages/nuwave-lighthouse)[aimeos/aimeos-laravel

Cloud native, API first Laravel eCommerce package with integrated AI for ultra-fast online shops, marketplaces and complex B2B projects

8.6k214.7k3](/packages/aimeos-aimeos-laravel)[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)[joselfonseca/lighthouse-graphql-passport-auth

Add GraphQL types and mutations for login and recover password functionalities

234769.9k1](/packages/joselfonseca-lighthouse-graphql-passport-auth)[alexaandrov/laravel-graphql-client

GraphQL client for laravel/lumen

125.6k](/packages/alexaandrov-laravel-graphql-client)

PHPackages © 2026

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