Internationalization library for PHP

1.4.3 2020-01-18 22:01 UTC

This package is auto-updated.

Last update: 2021-04-19 00:54:16 UTC


Internationalization library for PHP This library allows you to translate your website with ini files, Auto Detecting the language and much more!

Latest Stable Version Total Downloads Discord Server



i18n will create a folder named "i18n" please make sure it is readable


  1. Via composer: composer require stantabcorp/i18n
  2. Via manually download and install


In the i18n constructor your must-have 3 parameters:

  1. The language you want to display your website or true to use AutoDetect
  2. The default language
  3. An array of available languages
  4. An array of options

Example: Without AutoDetect:

$i18n = new i18n("en", "en", ["en", "fr"])

This will set the language to en (English), set the default language to en (English) and set that en (English) and fr (French) are available

With AutoDetect:

$i18n = new i18n(true, "en", ["en", "fr"])

This will set the language to AutoDetect, set the default language and set available language for AutoDetect


In order to get a translation you just need to:

$i18n->get("index in your file");

If you want to get the current language:


You want to change the language?


You don't want to use sprintf?! No problem:

$i18n->replace("string", [
    "string" => "strong"

Want to change the translation folder on the fly?


Want to get the active folder?


Want to set the available languages?


Want to get the available languages?


Now, let set and get the default language


File syntax

Sections are supported by i18n, see options to enable it

Example file:

word1 = "Some word"
word2 = "Some other word"


The fourth parameter when initializing the i18n class is an array.
Accepted values are:

  • error, a boolean to enable or disable error throwing
  • sections, a boolean to enable or not sections in the ini files
  • path, to set a path for the translations