PHPackages                             metarush/lang - 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. metarush/lang

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

metarush/lang
=============

Language translations / i18n / l10n with replaceable variables.

v1.0.0(6y ago)11221MITPHPPHP &gt;=7.1

Since Jul 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/metarush/lang)[ Packagist](https://packagist.org/packages/metarush/lang)[ RSS](/packages/metarush-lang/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (2)Used By (1)

metarush/lang
=============

[](#metarushlang)

Language translations / i18n / l10n with replaceable variables.

Sometimes you don't need a full-blown translation package. If all you want is to read a language translation source (e.g., Yaml file) and optionally replace variables on it on runtime, then this package is for you.

Install
-------

[](#install)

Install via composer as `metarush/lang`

Usage
-----

[](#usage)

1. Create a language file e.g., `en-US.yaml` and store it in a folder of your choice e.g., `locales/`
2. Put the ff. sample content in `en-US.yaml`:

```
foo: hello world
bar: the {{size}} {{color}} {{animal}} jumped
```

`foo` and `bar` will be the reference keys of each language string

3. Put the ff. in your PHP code:

```
$lang = (new \MetaRush\Lang\Builder())
            ->setLocalePath('path/to/locales/folder/')
            ->setLocale('en-US')
            ->build();

$foo = $lang->get('foo');

// $foo now contains 'hello world'
```

To replace variables on runtime:

```
$vars = [
    'size'   => 'big',
    'color'  => 'brown',
    'animal' => 'fox',
];

$bar = $lang->get('bar', $vars);

// $bar now contains 'the big brown fox jumped'
```

Additional settings
-------------------

[](#additional-settings)

### `->setOpenSyntax(string)`

[](#-setopensyntaxstring)

Change the open syntax of variables e.g., `->setOpenSyntax('%')`

### `->setCloseSyntax(string)`

[](#-setclosesyntaxstring)

Change the close syntax of variables e.g., `->setCloseSyntax('%')`

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

2508d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2efbbec5345d184bd2ffcb1c78f050fd7775cf1e52e64ab171e5673aaefc6daf?d=identicon)[zkwbbr](/maintainers/zkwbbr)

---

Top Contributors

[![zkwbbr](https://avatars.githubusercontent.com/u/45949485?v=4)](https://github.com/zkwbbr "zkwbbr (12 commits)")

---

Tags

phplocalizationinternationalizationi18ntranslationsl10nlanguage file

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/metarush-lang/health.svg)

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

###  Alternatives

[gettext/languages

gettext languages with plural rules

7530.3M11](/packages/gettext-languages)[punic/punic

PHP-Unicode CLDR

1542.9M29](/packages/punic-punic)[inpsyde/multilingual-press

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

2414.0k1](/packages/inpsyde-multilingual-press)[jrmajor/fluent

Fluent localization system for PHP

2716.9k5](/packages/jrmajor-fluent)[tigrov/yii2-country

Country data for Yii2 using Intl extension and more.

151.1k](/packages/tigrov-yii2-country)

PHPackages © 2026

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