PHPackages                             slendium/localization - 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. slendium/localization

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

slendium/localization
=====================

Framework-agnostic interfaces for localization.

v0.6.0(2mo ago)091MITPHPPHP ^8.4

Since Jan 31Pushed 2mo ago1 watchersCompare

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

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

Slendium/Localization
=====================

[](#slendiumlocalization)

A framework-agnostic PHP library for localization. Includes:

- PHPDocs with type hints for static analyzers
- Works with PHP-native standards ([RFC 4646, CLDR](https://www.php.net/manual/en/class.locale.php))

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

[](#installation)

Requires **PHP &gt;= 8.4**. Simply run `composer install slendium/localization` to add it to your project.

Example
-------

[](#example)

Create a domain-specific object with a translatable `$name` property.

```
class Product {
  /** @var Localizable */
  public Localizable $name;
}
```

Now consume this object in an `EmailGenerator` template.

```
class OrderEmailGenerator extends EmailGenerator {

  public function __construct(
    /** @var list */
    private array $products
  ) { }

  #[Override]
  public function generateBody(): iterable {
    yield $this->getSalutation($this->getCustomerName()); // combines localizable information with a customer name
    yield '';
    yield $this->translate('thanks_for_ordering'); // a Localizable from a static dictionary
    yield from [ '', $this->translate('product_category'), '' ];
    foreach ($this->products as $product) {
      yield from [ '', $product->name, '' ]; // $product->name is a localizable
    }
    yield '';
    yield $this->getSignature(); // another localizable
  }
}
```

The email generator can simply return a mix of markup and localizables to be converted to their translated equivalents at a later stage.

Motivation
----------

[](#motivation)

There are different ways of doing localization in PHP (array dictionaries, [gettext](https://www.php.net/manual/en/book.gettext.php), framework-specific implementations, etc.). Sometimes end-users can enter their own translations on a per-object basis - for example, using a database table. Code that is responsible for producing a locale-specific output (such as an HTML page, a JSON object, a PDF, an e-mail, etc.), or other libraries that want to work with localizable objects, should not need to know about the underlying dictionary implementation of such objects.

Pluralization is not part of this library, for now.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance87

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

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

Recently: every ~88 days

Total

6

Last Release

71d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8cb32e80bc8745da0070b0df3e42a7a4d0de1064a34bd32eafc341437f2b193?d=identicon)[packagist.uch8@frisiapp.com](/maintainers/packagist.uch8@frisiapp.com)

---

Top Contributors

[![cfahner](https://avatars.githubusercontent.com/u/3216275?v=4)](https://github.com/cfahner "cfahner (37 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/slendium-localization/health.svg)

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

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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