PHPackages                             syntaxseed/translator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. syntaxseed/translator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

syntaxseed/translator
=====================

Translate strings in your application to multiple languages loaded from JSON files.

v1.0.0(3y ago)15MITPHPPHP ^7.2|^7.3|^7.4|^8.0|^8.1|^8.2

Since Dec 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/syntaxseed/translator)[ Packagist](https://packagist.org/packages/syntaxseed/translator)[ RSS](/packages/syntaxseed-translator/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

JSON Translator
===============

[](#json-translator)

 [![GitHub tag (latest SemVer)](https://camo.githubusercontent.com/72218bd0e48173988a1495b44340a7cc97f56f94001f0a8dcab8033b5a45cffe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f73796e746178736565642f7472616e736c61746f722e737667)](https://camo.githubusercontent.com/72218bd0e48173988a1495b44340a7cc97f56f94001f0a8dcab8033b5a45cffe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f73796e746178736565642f7472616e736c61746f722e737667) [![PHP v8.0+](https://camo.githubusercontent.com/81e4e007d20e342305d6e5db0c1495a2e805692299266abe8665596e87bac30c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302b2d627269676874677265656e2e737667)](https://camo.githubusercontent.com/81e4e007d20e342305d6e5db0c1495a2e805692299266abe8665596e87bac30c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302b2d627269676874677265656e2e737667) [![PHP v8.1+](https://camo.githubusercontent.com/e6cebb42666cfbdd19ff9d0fb9412179dbb1f973ac2c65c5d4c9a3632fa40330/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312b2d627269676874677265656e2e737667)](https://camo.githubusercontent.com/e6cebb42666cfbdd19ff9d0fb9412179dbb1f973ac2c65c5d4c9a3632fa40330/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312b2d627269676874677265656e2e737667) [![License: MIT](https://camo.githubusercontent.com/23c3dfad2fdf6fa3824d4a488c8b4f3ef359a84c6dd7a65fe0b91e7200607f7a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73796e746178736565642f7472616e736c61746f72)](https://camo.githubusercontent.com/23c3dfad2fdf6fa3824d4a488c8b4f3ef359a84c6dd7a65fe0b91e7200607f7a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73796e746178736565642f7472616e736c61746f72)
 [![follow on Twitter](https://camo.githubusercontent.com/57ed9099a81a900fc8ddcc4173da21d688a269684c00c64c94c42c9b75faff3a/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f73796e746178736565642e7376673f7374796c653d736f6369616c266c6f676f3d74776974746572)](https://twitter.com/intent/follow?screen_name=syntaxseed) [![Sponsor Project](https://camo.githubusercontent.com/e699f94416c82026cff6cc197dbdeb21e3fcd1fb9622550f8fe9d89967dc337b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d50726f6a6563742d626c7565)](https://github.com/syntaxseed#donatecontribute)

Load JSON language files and translate them in your application.

- Licence: MIT
- Version: 1.0.0
- PHP Versions: 7.x, 8.0+, 8.1+, 8.2+
- Author: Sherri Wheeler
- Packagist:

Features
--------

[](#features)

- Easy to use, just set language and point to a JSON file.
- Uses the primary language as the lookup key, so strings are understandable in your application.
- Add any number of languages with a language key.
- All the translations for one string are in the same file/place.
- Fails silently - untranslated strings will just output the lookup string.
- Load more than one language file for different parts of your application.
- Short translation function name (`get`) for easy typing.
- Switch target language when needed.

Install
-------

[](#install)

Via Composer:

```
composer require syntaxseed/translator

```

Or add to composer.json:

```
"require": {
    "syntaxseed/translator": "^1.0"
},

```

Usage
-----

[](#usage)

> For a more in-depth example, see `examples/` directory.

```
use Syntaxseed\Translator\Translator;

require('../src/Translator.php');

// Initialize with base (lookup) language and target language to translate to.
$translations = new Translator('en', 'fr');
// Load a JSON file to the default lookup key.
$translations->loadLanguageFile(__DIR__.'/lang.json');

echo($translations->get('Hello World'));
```

Language File JSON Format
-------------------------

[](#language-file-json-format)

```
{
    "Email address" : {
        "fr" : "Addresse courriel",
        "es" : "Dirección de correo electrónico"
    },
    "Last name" : {
        "fr" : "Nom de famille",
        "es" : "Apellido"
    },
    "Your name" : {
        "fr" : "Votre nom",
        "es" : "Su nombre"
    }
}
```

Changelog
---------

[](#changelog)

- v1.0.0 - (2018-10-27) Created. Added to GitHub.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

1297d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/812750e6370c8e25a9fe430e200c80a92cd65a47a2e0d919f982cb5d264726e7?d=identicon)[syntaxseed](/maintainers/syntaxseed)

---

Top Contributors

[![syntaxseed](https://avatars.githubusercontent.com/u/825423?v=4)](https://github.com/syntaxseed "syntaxseed (6 commits)")

---

Tags

jsonlanguagetranslationstrings

### Embed Badge

![Health badge](/badges/syntaxseed-translator/health.svg)

```
[![Health](https://phpackages.com/badges/syntaxseed-translator/health.svg)](https://phpackages.com/packages/syntaxseed-translator)
```

###  Alternatives

[doctrine/inflector

PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.

11.3k900.4M876](/packages/doctrine-inflector)[phpoption/phpoption

Option Type for PHP

2.7k579.0M176](/packages/phpoption-phpoption)[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k430.4M1.7k](/packages/nette-utils)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k13.2M174](/packages/cuyz-valinor)[snipe/banbuilder

Library to easily handle profanity filtering in PHP projects.

3291.6M3](/packages/snipe-banbuilder)[patrickschur/language-detection

A language detection library for PHP. Detects the language from a given text string.

8603.6M21](/packages/patrickschur-language-detection)

PHPackages © 2026

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