PHPackages                             letkode/locale-bundle - 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. letkode/locale-bundle

ActiveSymfony-bundle[Localization &amp; i18n](/categories/localization)

letkode/locale-bundle
=====================

Locale provider, listener and translatable field applier for Symfony applications

1.0.1(today)01↑2900%MITPHPPHP ^8.4

Since Jun 19Pushed todayCompare

[ Source](https://github.com/letkode/locale-bundle)[ Packagist](https://packagist.org/packages/letkode/locale-bundle)[ RSS](/packages/letkode-locale-bundle/feed)WikiDiscussions main Synced today

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

letkode/locale-bundle
=====================

[](#letkodelocale-bundle)

Locale provider, listener and translatable field applier for Symfony applications.

---

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

[](#installation)

```
composer require letkode/locale-bundle
```

Symfony Flex will register the bundle automatically. If not using Flex, add it manually:

```
// config/bundles.php
return [
    Letkode\LocaleBundle\LetkodeLocaleBundle::class => ['all' => true],
];
```

---

Configuration
-------------

[](#configuration)

Create `config/packages/letkode_locale.yaml`:

```
letkode_locale:
    default_locale: '%env(APP_DEFAULT_LOCALE)%'
    supported_locales: '%env(json:APP_SUPPORTED_LOCALES)%'
```

Add the corresponding `.env` variables:

```
APP_DEFAULT_LOCALE=en
APP_SUPPORTED_LOCALES=["en","es"]
```

---

Contents
--------

[](#contents)

### `LocaleProvider`

[](#localeprovider)

Resolves the active locale for the current request. Inject it in services that need locale-awareness.

```
public function __construct(private readonly LocaleProvider $localeProvider) {}

public function doSomething(): void
{
    $locale = $this->localeProvider->getLocale(); // 'en' | 'es' | ...
}
```

### `LocaleListener`

[](#localelistener)

Kernel event listener (priority 20) that sets `$request->setLocale()` on every request. Reads from:

1. `_locale` query parameter
2. `Accept-Language` header (first matching supported locale)
3. Configured `default_locale` as fallback

### `TranslatableFieldApplier`

[](#translatablefieldapplier)

Applies translated values from a `translations` jsonb map to entity fields for the active locale.

```
// Entity has: public array|null $translations = null; (via HasTranslationsTrait)
// translations = {"en": {"name": "Module"}, "es": {"name": "Módulo"}}

$this->translatableFieldApplier->apply($entity, ['name']);
// $entity->name is now set to the locale-specific value
```

---

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

[](#requirements)

- PHP `^8.4`
- Symfony `^7.0 || ^8.0`

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

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

Total

2

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/562202fef9515226531f2d5c3b8cfc6a0a3a3bb61616204e56e3d93eaec3ed5f?d=identicon)[letkode.app](/maintainers/letkode.app)

---

Top Contributors

[![tjcalma](https://avatars.githubusercontent.com/u/4671171?v=4)](https://github.com/tjcalma "tjcalma (5 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/letkode-locale-bundle/health.svg)

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

PHPackages © 2026

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