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

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

romeoz/rock-i18n
================

i18n library for PHP

0.11.0(10y ago)29011MITPHPPHP &gt;=5.4.0

Since Mar 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/romeOz/rock-i18n)[ Packagist](https://packagist.org/packages/romeoz/rock-i18n)[ RSS](/packages/romeoz-rock-i18n/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (1)

Internationalization library for PHP
====================================

[](#internationalization-library-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/369712bc408047c7a511ffae3d1042b134a65db1432362f6837ae6fc1d3aa66c/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d6931386e2f762f737461626c652e737667)](https://packagist.org/packages/romeOz/rock-i18n)[![Total Downloads](https://camo.githubusercontent.com/4d9a7791e0bdfd15566a92caef375cdfcc6b3cca9b6c7945072780f06b1359c2/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d6931386e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/romeOz/rock-i18n)[![Build Status](https://camo.githubusercontent.com/f74741de0f983e00113cbdb49c45f99bdf4a5a2bc5c0605870f5812fbd1db4d1/68747470733a2f2f7472617669732d63692e6f72672f726f6d654f7a2f726f636b2d6931386e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/romeOz/rock-i18n)[![HHVM Status](https://camo.githubusercontent.com/149a16aaf15aa95acb22caa5757f6e1c6c971d67adaed0effb6c5d6948a332ec/687474703a2f2f6868766d2e683463632e64652f62616467652f726f6d656f7a2f726f636b2d6931386e2e737667)](http://hhvm.h4cc.de/package/romeoz/rock-i18n)[![Coverage Status](https://camo.githubusercontent.com/a2998ca408d8d0f90b90663dde6c65789520f25ca22d6a3c063394df640de7c2/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f726f6d654f7a2f726f636b2d6931386e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/romeOz/rock-i18n?branch=master)[![License](https://camo.githubusercontent.com/c6d41455f78cfde2e471af9341fa9f3bd8f1655bae73076736d56d9a159ac64a/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d6931386e2f6c6963656e73652e737667)](https://packagist.org/packages/romeOz/rock-i18n)

Features
--------

[](#features)

- Standalone module/component for [Rock Framework](https://github.com/romeOz/rock)

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

[](#installation)

From the Command Line:

```
composer require romeoz/rock-i18n

```

In your composer.json:

```
{
    "require": {
        "romeoz/rock-i18n": "*"
    }
}
```

Quick Start
-----------

[](#quick-start)

```
use rock\i18n\i18n;

$i18n = new i18n;

$i18n->add('hello', 'Hello {{placeholder}}');

$i18n->translate('hello', ['placeholder' => 'world!']); // output: Hello world!

// or

i18n::t('hello', ['placeholder' => 'Rock!']); // output: Hello Rock!
```

Documentation
-------------

[](#documentation)

\####addMulti(array $data)

Adds list i18-records as array.

```
use rock\i18n\i18n;

$i18n = new i18n;

$i18n->addMulti([
    'en' => [                // locale
        'lang' => [         // category
            'hello' => 'Hello world!'
        ]
    ],
    'ru' => [
        'lang' => [
            'hello' => 'Привет мир!'
        ]
    ]
]);
```

\####addDicts(array $dicts)

Adds dicts as paths.

```
use rock\i18n\i18n;

$config = [
    'pathDicts' => [
        'en' => [
                'path/to/en/lang.php',
                'path/to/en/validate.php',
            ]
        ]
     ]
];
$i18n = new i18n($config);

// or

$paths = [
    'en' => [
         'path/to/en/lang.php',
         'path/to/en/validate.php',
     ]
];
$i18n->addDicts($paths);
```

\###translate(string|array $keys, array $placeholders = \[\])

`$keys` can be a string, composite string (`months.nov`), or array (`['months', 'nov']`).

```
$i18n->translate('hello');
```

\###static t(string|array$keys, array $placeholders = \[\], $category = null, $locale = null)

Translation via the static method.

```
i18n::t('hello');
```

\###locale(string $locale)

Select locale.

```
use rock\i18n\i18n;

$i18n = new i18n;
$i18n->locale('fr');
$i18n->translate('hello');
```

\###category($category)

Select category.

```
use rock\i18n\i18n;

$i18n = new i18n;
$i18n->locale('fr')->category('validate');
$i18n->translate('required');
```

Requirements
------------

[](#requirements)

- **PHP 5.4+**

License
-------

[](#license)

Rock i18n library is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

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 ~61 days

Total

5

Last Release

3839d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23c5d84a59845d751cb69f5469986579b9312c54c898b366fefdc05baaa80a9c?d=identicon)[romeOz](/maintainers/romeOz)

---

Top Contributors

[![romeOz](https://avatars.githubusercontent.com/u/3135712?v=4)](https://github.com/romeOz "romeOz (20 commits)")

---

Tags

internationalizationi18nl10nlocalized

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symfony/intl

Provides access to the localization data of the ICU library

2.6k199.8M1.1k](/packages/symfony-intl)[gettext/languages

gettext languages with plural rules

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

Aplus Framework Language Library

2351.7M15](/packages/aplus-language)[punic/punic

PHP-Unicode CLDR

1542.9M29](/packages/punic-punic)[aura/intl

The Aura Intl package provides internationalization tools, specifically message translation.

898.3M4](/packages/aura-intl)[inpsyde/multilingual-press

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

2414.0k1](/packages/inpsyde-multilingual-press)

PHPackages © 2026

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