PHPackages                             piko/i18n - 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. piko/i18n

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

piko/i18n
=========

A minimal internationalization component that can be used in a piko application or standalone.

v2.3(7mo ago)0361LGPL-3.0-or-laterPHPPHP &gt;=7.1CI passing

Since Oct 10Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/piko-framework/i18n)[ Packagist](https://packagist.org/packages/piko/i18n)[ Docs](https://github.com/piko-framework/i18n)[ RSS](/packages/piko-i18n/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (8)Used By (1)

Piko I18n
=========

[](#piko-i18n)

[![build](https://github.com/piko-framework/i18n/actions/workflows/php.yml/badge.svg)](https://github.com/piko-framework/i18n/actions/workflows/php.yml)[![Coverage Status](https://camo.githubusercontent.com/ba7b665f13156afe35417e4c4caddc3d9d08ee0221d8d1d505f28db32e707971/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f70696b6f2d6672616d65776f726b2f6931386e2f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/piko-framework/i18n?branch=main)

A minimal internationalization component which can be used in a piko application or standalone.

Installation
------------

[](#installation)

It's recommended that you use Composer to install Piko I18n.

```
composer require piko/i18n
```

Usage
-----

[](#usage)

In order to use the I18n component, translations have to be stored in PHP files that return a key-value pair array of translations. Keys are strings to translate and values are corresponding translated strings.

Example of translation file *fr.php* :

```
return [
    'Translation test' => 'Test de traduction',
    'Hello {name}' => 'Bonjour {name}',
];
```

Application structure example:

```
App root
  |__messages
    |__fr.php
  |__index.php

```

Usage in a piko application
---------------------------

[](#usage-in-a-piko-application)

index.php :

```
use Piko\Application;
use function Piko\I18n\__;

require('vendor/autoload.php');

$config = [
    'basePath' => __DIR__,
    'components' => [
        'Piko\I18n' => [
            'translations' => [
                'app' => '@app/messages',
            ],
            'language' => 'fr'
        ],
    ],
];

$app = new Application($config);

$i18n = $app->getComponent('Piko\I18n');

echo $i18n->translate('app', 'Translation test') . ''; // Test de traduction
echo $i18n->translate('app', 'Hello {name}', ['name' => 'John']) . '' ; // Bonjour John

// Using the proxy function __() :
I18n::setInstance($i18n); // Required to use the function __()
echo __('app', 'Translation test') . ''; // Test de traduction
echo __('app', 'Hello {name}', ['name' => 'John']) . '' ;  // Bonjour John
```

Usage in a standalone script
----------------------------

[](#usage-in-a-standalone-script)

```
use Piko\I18n;
use function Piko\I18n\__;

require('vendor/autoload.php');

$i18n = new I18n(['app' => __DIR__ . '/messages'], 'fr');

echo $i18n->translate('app', 'Translation test') . '';
echo $i18n->translate('app', 'Hello {name}', ['name' => 'John']) . '' ;

// Using the proxy function __() :
I18n::setInstance($i18n); // Required to use the function __()
echo __('app', 'Translation test') . '';
echo __('app', 'Hello {name}', ['name' => 'John']) . '' ;
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance65

Regular maintenance activity

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

###  Release Activity

Cadence

Every ~182 days

Recently: every ~267 days

Total

7

Last Release

214d ago

Major Versions

v1.1 → v2.02022-11-06

PHP version history (2 changes)v1.0PHP &gt;=7.1.0

v2.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/001b70c85d853a2aae5f1bf74a1ff7ad77ffcec2d423090d67293bde99158350?d=identicon)[ilhooq](/maintainers/ilhooq)

---

Top Contributors

[![ilhooq](https://avatars.githubusercontent.com/u/1500886?v=4)](https://github.com/ilhooq "ilhooq (16 commits)")

---

Tags

internationalizationi18nlanguagetranslation

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/piko-i18n/health.svg)

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

###  Alternatives

[tractorcow/silverstripe-fluent

Simple localisation for Silverstripe

92421.6k26](/packages/tractorcow-silverstripe-fluent)[gettext/languages

gettext languages with plural rules

7530.3M10](/packages/gettext-languages)[aplus/language

Aplus Framework Language Library

2351.7M15](/packages/aplus-language)[inpsyde/multilingual-press

Simply THE multisite-based free open source plugin for your multilingual websites.

2414.0k1](/packages/inpsyde-multilingual-press)[delight-im/i18n

Internationalization and localization for PHP

625.2k3](/packages/delight-im-i18n)[jrmajor/fluent

Fluent localization system for PHP

2716.9k5](/packages/jrmajor-fluent)

PHPackages © 2026

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