PHPackages                             a3gz/simple-locale - 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. a3gz/simple-locale

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

a3gz/simple-locale
==================

Simple locale

1.7.1(6y ago)0800MITPHP

Since Jun 18Pushed 6y agoCompare

[ Source](https://github.com/a3gz/simple-locale)[ Packagist](https://packagist.org/packages/a3gz/simple-locale)[ Docs](https://github.com/a3gz/simple-locale)[ RSS](/packages/a3gz-simple-locale/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (11)Used By (0)

Simple Locale
=============

[](#simple-locale)

Install
-------

[](#install)

```
composer require a3gz/simple-locale

```

Setup
-----

[](#setup)

Create an associative array with the settings having:

1. `languages`: An array of language codes. The codes used here are completely arbitrary.
2. `env`: Several environment settings for each language so the localizer knows how to format things like currency and dates.
3. `dictionaries`: Here we provide the dictionary files where string keys are associated to translations.

A typical settings array would look like this

```
$settings = [
  'languages' => ['en'],
  'env' => [
    'en' => [
      /* Numbers */
      'decimals' => 2,
      'decimalPoint' => '.',
      'thousandsSeparator' => ' ',
      /* Currency */
      'symbolBefore' => '$ ',
      'symbolAfter' => '',
      /* Dates */
      'timestamp' => 'Y-m-d H:i:s',
      'short' => 'Y/m/d',
      'long' => 'M j, Y',
      'longer' => 'M j, Y \a\t H:i:s',
    ],
    'fr' => false,
    'es' => false,
  ],
  'dictionaries' => [
    function($languageCode) {
      $base = dirname(__DIR__) . '/domain/locale';
      $dn = "{$base}/{$languageCode}/dictionary.php";
      if (is_readable($dn)) {
        return @include($dn);
      }
    },
  ],
];

```

### About dictionaries

[](#about-dictionaries)

A dictionary is a PHP file that returns an associative array having string keys and translations as shown below:

```
return [
  'hello world' => 'Hola mundo!',
];

```

An application may have one or more dictionaries and this is why the `dictionaries` section is expected to be an array. The demo above shows the simplest form where all translations are located in one file.

Although it isn't required, it is suggested that dictionaries are located inside a directory named as the corresponding language code defined under the `languages` section. Note the part where the full path to the dictionary file is built:

```
$dn = "{$base}/{$code}/dictionary.php";

```

Usage
-----

[](#usage)

```
$locale = new Locale($settings);

echo $locale->dictionary->say('hello world');
echo $locale->currency->format12.50);

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity65

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

Total

9

Last Release

2438d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/71a4c7affb109a5e4a15bdeaf55b70e268d59b0101c8ebacf899cb8e237c4950?d=identicon)[a3gz](/maintainers/a3gz)

---

Top Contributors

[![a3gz](https://avatars.githubusercontent.com/u/84980?v=4)](https://github.com/a3gz "a3gz (25 commits)")

### Embed Badge

![Health badge](/badges/a3gz-simple-locale/health.svg)

```
[![Health](https://phpackages.com/badges/a3gz-simple-locale/health.svg)](https://phpackages.com/packages/a3gz-simple-locale)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.0k](/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.4M491](/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)
