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 today

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 70% 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.6k822.3M1.8k](/packages/symfony-translation)[commerceguys/addressing

Addressing library powered by CLDR and Google's address data.

95229.5M35](/packages/commerceguys-addressing)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

170648.9M4.3k](/packages/nesbot-carbon)[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.5M16](/packages/barryvdh-laravel-translation-manager)[a2lix/translation-form-bundle

Translate your doctrine objects easily with some helpers

3436.9M37](/packages/a2lix-translation-form-bundle)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

716892.4k8](/packages/joedixon-laravel-translation)

PHPackages © 2026

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