Skip to content
A PHP implementation of i18next. With a web rest API.
Branch: master
Clone or download
pkly Changed how I18n has to be initialized to be more like the JS version…
… (which makes more sense anyway)

Added PostProcessorInterface, DetectorInterface, Detector plugins, LanguageDetector and BaseLanguageDetector classes

Post processors are now required to implement PostProcessorInterface
Added DetectionTest, updated examples and tests to reflect the ->init() change
Latest commit 96c675b Oct 11, 2019


A port of i18next in PHP. With a rest API. (coming soon [tm])

Code in this repository is largely based on the original code base in JavaScript, rewritten in PHP. This project focuses only on the newest version of i18next, disregarding compatibility with previous ones.


This version is usable, but could contain bugs. If you find any issues please report them or create a PR.


  • PSR3 logging support (psr/log is a hard requirement, but you're not required to actually use a logger)
  • Extremely similar API to the JS version
  • PHP-specific features like interfaces for modules
  • PHP 7.3+
  • Automatic language detection support


View all examples here

Basic example

// You can also use I18n globally via I18n::get()

$i18n = new I18n([
    'lng'           =>  'en',
    'resources'     =>  [
        'en'        =>  [
            'translation'       =>  [
                'key'           =>  'Value',
                'key_plural'    =>  'Value plural'
                'deeper'        =>  [
                    'key'           =>  'Deep value'

$i18n->t('key'); // "Value"
$i18n->t('key', ['count' => 5]); // "Value plural"
$i18n->t('deeper.key'); // "Depp value"


Simply enter your project directory and run

composer require pkly/i18next-php


  • Add event emitting


Visit the page here


If you want feel free to buy me a coffee by clicking here

You can’t perform that action at this time.