PHPackages                             g4t/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. g4t/enum

ActiveLibrary

g4t/enum
========

PHP Enums

0.0.1(4y ago)05MITPHP

Since Feb 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hussein4alaa/laravel-enum)[ Packagist](https://packagist.org/packages/g4t/enum)[ Docs](https://github.com/g4t/laravel-enum)[ RSS](/packages/g4t-enum/feed)WikiDiscussions 0.0.1 Synced 1w ago

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

Laravel Enum
============

[](#laravel-enum)

This package offers strongly typed enums in PHP. In this package we will change the value coming from the database and entered into it

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

[](#installation)

Via Composer

```
composer require g4t/enum
```

```
php artisan vendor:publish --provider=g4t\Enum\EnumServiceProvider
```

Usage
-----

[](#usage)

use the following code in model

```
use g4t\Enum\Status;
.
.
.

protected $casts = [
  'column_name' => Status::class,
];

```

now go to `config/enum.php` you well find this example there:

##### In the following code, the key is the value allowed in the database

[](#in-the-following-code-the-key-is-the-value-allowed-in-the-database)

##### and value is the format to be output instead of the one in the database

[](#and-value-is-the-format-to-be-output-instead-of-the-one-in-the-database)

```
