PHPackages                             elaborate-code/php-json-tongue - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. elaborate-code/php-json-tongue

ActiveLibrary[Localization &amp; i18n](/categories/localization)

elaborate-code/php-json-tongue
==============================

A Facade for loading localization data from JSONs within a lang folder

v1.2.1(3y ago)33.0k2MITPHPPHP ^8.0

Since Sep 23Pushed 3y agoCompare

[ Source](https://github.com/elaborate-code/php-json-tongue)[ Packagist](https://packagist.org/packages/elaborate-code/php-json-tongue)[ Docs](https://github.com/elaborate-code/php-json-tongue)[ RSS](/packages/elaborate-code-php-json-tongue/feed)WikiDiscussions main Synced yesterday

READMEChangelog (5)Dependencies (5)Versions (7)Used By (2)

PHP JSON tongue
===============

[](#php-json-tongue)

[![Packagist Version](https://camo.githubusercontent.com/904c842d8a52511b79609edfe7f92a7f5f1641926a721976be798f8649d17aa6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c61626f726174652d636f64652f7068702d6a736f6e2d746f6e6775653f6c6162656c3d56657273696f6e267374796c653d706c6173746963)](https://packagist.org/packages/elaborate-code/php-json-tongue)[![Packagist Downloads](https://camo.githubusercontent.com/601d4241fd3f87c77f8678d9589b00b3c38325379bffef95204a029ef36216d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c61626f726174652d636f64652f7068702d6a736f6e2d746f6e6775653f6c6162656c3d446f776e6c6f616473267374796c653d706c6173746963)](https://camo.githubusercontent.com/601d4241fd3f87c77f8678d9589b00b3c38325379bffef95204a029ef36216d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c61626f726174652d636f64652f7068702d6a736f6e2d746f6e6775653f6c6162656c3d446f776e6c6f616473267374796c653d706c6173746963)[![run-tests](https://github.com/elaborate-code/php-json-tongue/actions/workflows/run-tests.yml/badge.svg)](https://github.com/elaborate-code/php-json-tongue/actions/workflows/run-tests.yml)[![Test Coverage](https://raw.githubusercontent.com/elaborate-code/php-json-tongue/main/badge-coverage.svg)](https://raw.githubusercontent.com/elaborate-code/php-json-tongue/main/badge-coverage.svg)[![Fix PHP code style issues](https://github.com/elaborate-code/php-json-tongue/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/elaborate-code/php-json-tongue/actions/workflows/fix-php-code-style-issues.yml)[![maintained](https://camo.githubusercontent.com/652950e93cdb2b41c0c752ae200d6defea506fa6b49a80fc38c349f9757c08cc/68747470733a2f2f696d672e736869656c64732e696f2f6d61696e74656e616e63652f7965732f32303232)](https://camo.githubusercontent.com/652950e93cdb2b41c0c752ae200d6defea506fa6b49a80fc38c349f9757c08cc/68747470733a2f2f696d672e736869656c64732e696f2f6d61696e74656e616e63652f7965732f32303232)

A Façade for loading localization data from a folder tree of JSON files.

Get started
-----------

[](#get-started)

Install the package with composer:

```
composer require elaborate-code/php-json-tongue

```

Requirements:

- PHP 8.0 or higher

Usage
-----

[](#usage)

Set the file structure.

[![illustration](illustration.png)](illustration.png)

Then use the facade.

```
use ElaborateCode\JsonTongue\TongueFacade;

$tongue = new TongueFacade('/lang');

$localization = $tongue->transcribe();
```

`$localization` will be set like:

```
$localization = [
    "es" => [
        "programmer" => "programador",
        "interviewer" => "entrevistador",
        "Hello" => "Hola",
        "Good morning" => "buenos dias",
        //...
    ],
    "fr" => [
        "Hello" => "Salut",
        "Good morning" => "Bonjour",
        //...
    ]
    //...
];
```

Testing
-------

[](#testing)

```
vendor/bin/pest
```

### JSON Faker

[](#json-faker)

Just like when testing Laravel apps, we populate the database temporarily and use the `RefreshDatabase` trait to rollback the database to its fresh state.

This package ships with `ElaborateCode\JsonTongue\JsonFaker\JsonFaker` class that helps create a temporary tree of **locale folders** and **JSON files** filled with translations.

Here is an example:

```
$json_faker = JsonFaker::make()
    ->addLocale('ar', [
        'ar.json' => [],
    ])
    ->addLocale('en', [
        'en.json' => [
            'en' => 'en',
            "I know. They're both good. It's hard to decide. McCain is older but he has more experience. Obama seems to have a lot of good ideas, but some people say he wants to raise taxes." => 'Lo sé. Ambos son buenos. Es difícil decidir. McCain es mayor pero tiene más experiencia. Obama parece tener muchas buenas ideas, pero algunas personas dicen que quiere aumentar los impuestos.',
        ],
        'one.json' => [
            'one' => 'one',
        ],
        'two.json' => [
            'two' => 'two',
        ],
    ])
    ->addLocale('multi', [
        'greetings.json' => [
            'en' => [
                'Hello' => 'Hello',
            ],
            'fr' => [
                'Hello' => 'Salut',
            ],
        ],
    ])
    ->write();

// Assert

$json_faker->rollback(); // Delete the complete file structure created for the test
```

> This class can help make tests when contributing on this package or when using this package.

Changelog
---------

[](#changelog)

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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 ~3 days

Total

5

Last Release

1364d ago

### Community

Maintainers

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

---

Top Contributors

[![medilies](https://avatars.githubusercontent.com/u/35309918?v=4)](https://github.com/medilies "medilies (44 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

agnosticinternationalizationjsonlanguageslibrarylocalelocalizationphpphp8translationjsonlocalizationinternationalizationlanguagestranslationlocale

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/elaborate-code-php-json-tongue/health.svg)

```
[![Health](https://phpackages.com/badges/elaborate-code-php-json-tongue/health.svg)](https://phpackages.com/packages/elaborate-code-php-json-tongue)
```

###  Alternatives

[gettext/languages

gettext languages with plural rules

7832.7M12](/packages/gettext-languages)[tractorcow/silverstripe-fluent

Simple localisation for Silverstripe

91437.9k29](/packages/tractorcow-silverstripe-fluent)[laravel-lang/locale-list

List of localizations available in Laravel Lang projects

105.6M16](/packages/laravel-lang-locale-list)[skillshare/formatphp

Internationalize PHP apps. This library provides an API to format dates, numbers, and strings, including pluralization and handling translations.

8032.4k](/packages/skillshare-formatphp)[delight-im/i18n

Internationalization and localization for PHP

595.4k3](/packages/delight-im-i18n)[jrmajor/fluent

Fluent localization system for PHP

2918.2k7](/packages/jrmajor-fluent)

PHPackages © 2026

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