PHPackages                             domthomas-dev/laravel-localized-enum - 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. domthomas-dev/laravel-localized-enum

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

domthomas-dev/laravel-localized-enum
====================================

A Laravel package for managing localized enums with automatic translation support

1.0.0(8mo ago)54MITPHPPHP ^8.1

Since Sep 12Pushed 8mo agoCompare

[ Source](https://github.com/domthomas-dev/laravel-localized-enum)[ Packagist](https://packagist.org/packages/domthomas-dev/laravel-localized-enum)[ RSS](/packages/domthomas-dev-laravel-localized-enum/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

[![image.png](image.png)](image.png)

Laravel Localized Enum
======================

[](#laravel-localized-enum)

A Laravel package that provides automatic localization support for PHP enums, making it easy to display translated enum values in your application.

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

[](#installation)

You can install the package via Composer:

```
composer require domthomas-dev/laravel-localized-enum
```

The package will automatically register its service provider.

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

[](#configuration)

Optionally, you can publish the configuration file:

```
php artisan vendor:publish --tag=localized-enum-config
```

This will create a `config/localized-enum.php` file where you can customize:

```
return [
    // Default label type when none is specified
    'default_label' => 'label',

    // Translation file name (without .php extension)
    'translation_file' => 'enums',
];
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Add the `LocalizedEnum` trait to your enum:

```
