PHPackages                             rancoud/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. [Testing &amp; Quality](/categories/testing)
4. /
5. rancoud/i18n

ActiveLibrary[Testing &amp; Quality](/categories/testing)

rancoud/i18n
============

I18N package

2.0.0(5y ago)014MITPHPPHP &gt;=7.4.0CI failing

Since Dec 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/rancoud/I18N)[ Packagist](https://packagist.org/packages/rancoud/i18n)[ RSS](/packages/rancoud-i18n/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

I18N Package
============

[](#i18n-package)

[![Packagist PHP Version Support](https://camo.githubusercontent.com/fa143972b6286a4b7bee7a6c4d632ce17603b0e3a97bb1e7e6885722d0fbf67b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f72616e636f75642f6931386e)](https://camo.githubusercontent.com/fa143972b6286a4b7bee7a6c4d632ce17603b0e3a97bb1e7e6885722d0fbf67b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f72616e636f75642f6931386e)[![Packagist Version](https://camo.githubusercontent.com/5b51c9a12fb1ef646876a067a3f5b557e82aacc3f11404c80f65df3c15bc98af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72616e636f75642f6931386e)](https://packagist.org/packages/rancoud/i18n)[![Packagist Downloads](https://camo.githubusercontent.com/bf93290b5c4956504fa1950e3542f34156e95d9a04afddf5157a7a0f6bf322f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616e636f75642f6931386e)](https://packagist.org/packages/rancoud/i18n)[![Composer dependencies](https://camo.githubusercontent.com/aae95fbaa83bc6a3f4597f3a75da45ea46ec236fc324617f0e5a2f15e07fe750/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e)](https://github.com/rancoud/i18n/blob/master/composer.json)[![Test workflow](https://camo.githubusercontent.com/795cb6ac32ca3036a223d3daf1ad4dc27b824545feab6d917d021cbbc3b88874/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f72616e636f75642f6931386e2f746573743f6c6162656c3d74657374266c6f676f3d676974687562)](https://github.com/rancoud/i18n/actions?workflow=test)[![Codecov](https://camo.githubusercontent.com/3040485acec30368e4b0f4b0fcfcb6b23dd70017d4dc8d7109b66ee3217658e5/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f72616e636f75642f6931386e3f6c6f676f3d636f6465636f76)](https://codecov.io/gh/rancoud/i18n)[![composer.lock](https://camo.githubusercontent.com/c873f0d2b0af882455270ab5006f5242d39f1e91a2390b36e517b97c3f7cd523/68747470733a2f2f706f7365722e707567782e6f72672f72616e636f75642f6931386e2f636f6d706f7365726c6f636b)](https://packagist.org/packages/rancoud/i18n)

I18N.

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

[](#installation)

```
composer require rancoud/i18n
```

How to use it?
--------------

[](#how-to-use-it)

You need a file `LANG.php` where LANG is the filename.
It will contains an array key values:

```
return [
    'Hello' => 'Bonjour'
];
```

You have to set the default directory and language

```
$defaultDirectory = '/path/to/translations/';
$defaultLanguage = 'en';
I18N::setDefaults($directory, $defaultLanguage);
```

In action:

```
I18N::echo('Hello');
// it will produce in output 'Hello'

I18N::echo('another string');
// it will produce in output 'another string' because the key doesn't exist in the file

$string = I18N::get('Hello');
// it will return 'Hello'

// you can use different language file instead of the default one
$string = I18N::get('string in other lang', 'es');
// it will return the translation of 'string in other lang' present in the es.php file
```

I18N Methods
------------

[](#i18n-methods)

### General static Commands

[](#general-static-commands)

- setDefaults(directory: string, language: string):void
- echo(key: string, \[language: string = null\]):void
- get(key: string, \[language: string = null\]):string

How to Dev
----------

[](#how-to-dev)

`composer ci` for php-cs-fixer and phpunit and coverage
`composer lint` for php-cs-fixer
`composer test` for phpunit and coverage

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

2

Last Release

2119d ago

Major Versions

1.0.0 → 2.0.02020-07-27

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

2.0.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/829a536bd4f71cadcd0266e272ccaf413e3fc9f2937248c9a2317ef0bf2d25ee?d=identicon)[rancoud](/maintainers/rancoud)

---

Top Contributors

[![rancoud](https://avatars.githubusercontent.com/u/1884186?v=4)](https://github.com/rancoud "rancoud (9 commits)")

---

Tags

composercoveragei18npackagistphpphp74phpunitphpunit9

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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