PHPackages                             ifresh/laravel-enum-translations - 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. ifresh/laravel-enum-translations

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

ifresh/laravel-enum-translations
================================

1.0.5(3mo ago)11.4k—7.1%3MITPHPPHP ^8.1

Since Oct 18Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/iFreshDevelopment/laravel-enum-translations)[ Packagist](https://packagist.org/packages/ifresh/laravel-enum-translations)[ RSS](/packages/ifresh-laravel-enum-translations/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (6)Dependencies (15)Versions (12)Used By (0)

Simple Enum translations for Laravel
====================================

[](#simple-enum-translations-for-laravel)

a Laravel package that simplifies the translation of enums in your applications, making it easy to associate enum values with translated labels for multiple languages. It enhances code readability and maintainability by handling enum translations seamlessly.

This makes it super easy to provide your front-end with a list of enum-keys with corresponding labels.

Features
--------

[](#features)

- Automatically load translated labels for your application Enums
- Provide a fallback based on the enum key to easily find missing translations
- Follows the configured locale of your application

Getting started
---------------

[](#getting-started)

1. Use [composer](https://getcomposer.org) to install the package `composer require ifresh/laravel-enum-translations`
2. Publish the configuration files `./artisan vendor:publish --tag=laravel-enum-translations`
3. Modify the `lang/en/enums.php` file OR copy this file to your application's locale folder.

Example
-------

[](#example)

Given the following enum:

```
namespace App\Enums;

enum Cards: string
{
    case Hearts = 'hearts';
    case Diamonds = 'diamonds';
    case Clubs = 'clubs';
    case Spades = 'spades';
}
```

You can add translated values by modifying the `lang/en/enums.php` file:

```
return [
    'cards' => [
        'hearts' => 'Hearts ❤️',
        'diamonds' => 'Diamonds 💎',
        'clubs' => 'Clubs ♣️',
        'spades' => 'Spades ♠️',
    ],
];
```

Now to use these translations in your application by using the `EnumTranslatorFacade`:

If you simply want to get the list of all the translations for a single Enum (for instance when filling a dropdown) you can use the `translate` method available on the Facade:

```
use App\Enums\Cards;
use IFresh\EnumTranslations\EnumTranslatorFacade as EnumTranslator;

$translations = EnumTranslator::translate(Cards::class);
/*
 * [
 *   'hearts' => 'Hearts ❤️',
 *   'diamonds' => 'Diamonds 💎',
 *   'clubs' => 'Clubs ♣️',
 *   'spades' => 'Spades ♠️',
 * ]
 */
```

It is also possible to get the translated value for a single enum value, to do this you can use the `translateValue` method instead:

```
EnumTranslator::translateValue(Cards::class, Cards::Hearts); // 'Hearts ❤️'
```

When you pass `null` as the selected enum value, an empty string is returned:

```
EnumTranslator::translateValue(Cards::class, null); // ''
```

Contributing
------------

[](#contributing)

All contributions are welcome! Please open a GitHub Issue or create a Pull-request

License
-------

[](#license)

The Laravel enum translations package is free software released under the MIT License. See [LICENSE.txt](LICENSE.txt) for details.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance82

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% 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 ~89 days

Recently: every ~182 days

Total

11

Last Release

96d ago

Major Versions

v0.4.1 → v1.0.02024-03-28

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/86951752?v=4)[Stephan Bouman](/maintainers/sbouman)[@sbouman](https://github.com/sbouman)

---

Top Contributors

[![stephanbouman](https://avatars.githubusercontent.com/u/67788644?v=4)](https://github.com/stephanbouman "stephanbouman (5 commits)")[![tkuijer](https://avatars.githubusercontent.com/u/1401811?v=4)](https://github.com/tkuijer "tkuijer (3 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/ifresh-laravel-enum-translations/health.svg)

```
[![Health](https://phpackages.com/badges/ifresh-laravel-enum-translations/health.svg)](https://phpackages.com/packages/ifresh-laravel-enum-translations)
```

###  Alternatives

[illuminate/validation

The Illuminate Validation package.

18838.2M1.7k](/packages/illuminate-validation)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[illuminate/translation

The Illuminate Translation package.

6938.0M572](/packages/illuminate-translation)

PHPackages © 2026

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