PHPackages                             aiken/i18next - 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. aiken/i18next

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

aiken/i18next
=============

PHP class for basic i18next functionality

1341.7k↓17.8%15[1 issues](https://github.com/Mika-/i18next-php/issues)PHP

Since Jun 24Pushed 5y ago4 watchersCompare

[ Source](https://github.com/Mika-/i18next-php)[ Packagist](https://packagist.org/packages/aiken/i18next)[ RSS](/packages/aiken-i18next/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

i18next-php
===========

[](#i18next-php)

PHP class for basic [i18next](https://github.com/jamuhl/i18next) functionality.

Features
--------

[](#features)

- Support for [variables](http://i18next.com/pages/doc_features.html#interpolation)
- Support for [context](http://i18next.com/pages/doc_features.html#context)
- Support for [basic sprintf](http://i18next.com/pages/doc_features.html#sprintf)
- Support for [basic plural forms](http://i18next.com/pages/doc_features.html#plurals)
- Support for [multiline in JSON](http://i18next.com/pages/doc_features.html)

Usage
-----

[](#usage)

```
// init i18next instance
i18next::init('en');

// get translation by key
echo i18next::getTranslation('animal.dog');
```

Methods
-------

[](#methods)

### i18next::init( string $languageKey \[, string $path \] );

[](#i18nextinit-string-languagekey--string-path--)

Loads translation files from given path. Looks for `translation.json` by default.

```
i18next::init('en', 'my/path/');
// loads my/path/translation.json
```

You can also use variables and split namespaces and languages to different files.

```
i18next::init('en', 'languages/__lng__/__ns__.json');
// loads languages/en/animal.json, languages/fi/animal.json, etc...
```

Method throws an exception if no files are found or the json can not be parsed.

### mixed i18next::getTranslation( string $key \[, array $variables \] );

[](#mixed-i18nextgettranslation-string-key--array-variables--)

Returns translated string by key.

```
i18next::getTranslation('animal.catWithCount', array('count' => 2, 'lng' => 'fi'));
```

### boolean i18next::existTranslation( string $key );

[](#boolean-i18nextexisttranslation-string-key-)

Checks if translated string exists.

### void i18next::setLanguage( string $language \[, string $fallback \] );

[](#void-i18nextsetlanguage-string-language--string-fallback--)

Changes language.

### array i18next::getMissingTranslations();

[](#array-i18nextgetmissingtranslations)

Gets an array of missing translations.

```
array(1) {
    [0]=> array(2) {
        ["language"]=> string(2) "en"
        ["key"]=> string(14) "animal.unknown"
    }
}

```

Multilines in JSON-arrays
-------------------------

[](#multilines-in-json-arrays)

You can have html content written with multilines in JSON File

```
{
	"en": {
		"common": {
			"thedoglovers": [
                "The Dog Lovers by Spike Milligan",
                "So they bought you",
                "And kept you in a",
                "Very good home"
            ]
        }
	}
}

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.9% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d52225e0ea7d25eaaf31a0a83c874c67df63956a3b0e0598667213f05a098bd?d=identicon)[Aiken](/maintainers/Aiken)

---

Top Contributors

[![Mika-](https://avatars.githubusercontent.com/u/5081253?v=4)](https://github.com/Mika- "Mika- (31 commits)")[![JosefMor](https://avatars.githubusercontent.com/u/3066976?v=4)](https://github.com/JosefMor "JosefMor (2 commits)")

---

Tags

i18ni18nextphp54

### Embed Badge

![Health badge](/badges/aiken-i18next/health.svg)

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

###  Alternatives

[php-translation/translator

Translator services

25224.8k5](/packages/php-translation-translator)[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1926.6k1](/packages/smmoosavi-php-gettext)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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