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

ActiveLibrary

codica-studio/enum
==================

A random Codica Studio package.

3.0.1(5y ago)01MITPHPPHP ^7.4CI failing

Since Oct 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/codicastudio/enum)[ Packagist](https://packagist.org/packages/codica-studio/enum)[ Docs](https://github.com/codicastudio/enum)[ RSS](/packages/codica-studio-enum/feed)WikiDiscussions master Synced today

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

About Enum
----------

[](#about-enum)

Simple, extensible and powerful enumeration implementation for Laravel.

- Enum key value pairs as class constants
- Full featured suite of methods
- Enum instantiation
- Flagged/Bitwise enums
- Type hinting
- Attribute casting
- Enum artisan generator
- Validation rules for passing enum key or values as input parameters
- Localization support
- Extendable via Macros

Jump To
-------

[](#jump-to)

- [Guide](#guide)
- [Installation](#installation)
- [Enum Library](enum-library.md)
- [Basic Usage](#basic-usage)
    - [Enum definition](#enum-definition)
    - [Instantiation](#instantiation)
    - [Instance Properties](#instance-properties)
    - [Instance Equality](#instance-equality)
    - [Type Hinting](#instance-equality)
- [Flagged/Bitwise Enum](#flaggedbitwise-enum)
- [Attribute Casting](#attribute-casting)
- [Migrations](#migrations)
- [Validation](#validation)
- [Localization](#localization)
- [Overriding the getDescription method](#overriding-the-getdescription-method)
- [Extending the Enum Base Class](#extending-the-enum-base-class)
- [Laravel Nova Integration](#laravel-nova-integration)
- [PHPStan Integration](#phpstan-integration)
- [Artisan Command List](#artisan-command-list)
- [Enum Class Reference](#enum-class-reference)

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

[](#installation)

### Requirements

[](#requirements)

- Laravel `8` or higher
- PHP `7.3` or higher

Via Composer

```
composer require codicastudio/enum
```

Enum Library
------------

[](#enum-library)

Browse and download from a list of commonly used, community contributed enums.

[Enum library →](enum-library.md)

Basic Usage
-----------

[](#basic-usage)

### Enum Definition

[](#enum-definition)

You can use the following Artisan command to generate a new enum class:

```
php artisan make:enum UserType
```

Now, you just need to add the possible values your enum can have as constants.

```
