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

1338.0k↑43.9%15[1 issues](https://github.com/Mika-/i18next-php/issues)PHP

Since Jun 24Pushed 4y ago4 watchersCompare

[ Source](https://github.com/Mika-/i18next-php)[ Packagist](https://packagist.org/packages/aiken/i18next)[ RSS](/packages/aiken-i18next/feed)WikiDiscussions master Synced 1mo 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 68% 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

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.0k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.7k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M490](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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