PHPackages                             othyn/php-enum-enhancements - 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. othyn/php-enum-enhancements

AbandonedArchivedLibrary

othyn/php-enum-enhancements
===========================

Adds some helpful enum traits to the glorious new PHP Enum type.

v1.0.1(4y ago)1925.9k↓40.5%MITHTMLPHP ^8.1

Since Feb 15Pushed 3y ago2 watchersCompare

[ Source](https://github.com/othyn/php-enum-enhancements)[ Packagist](https://packagist.org/packages/othyn/php-enum-enhancements)[ RSS](/packages/othyn-php-enum-enhancements/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

PHP Enum Enhancements
=====================

[](#php-enum-enhancements)

[![Tests](https://github.com/othyn/php-enum-enhancements/actions/workflows/phpunit.yml/badge.svg)](https://github.com/othyn/php-enum-enhancements/actions/workflows/phpunit.yml)[![Code Style](https://github.com/othyn/php-enum-enhancements/actions/workflows/phpcsfixer.yml/badge.svg)](https://github.com/othyn/php-enum-enhancements/actions/workflows/phpcsfixer.yml)[![Downloads](https://camo.githubusercontent.com/9912dd73e0198ca80710c608cdf55db9352d7bcd76037f870ed05437990d49c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f7468796e2f7068702d656e756d2d656e68616e63656d656e74733f636f6c6f723d677265656e)](#installation)[![GitHub license](https://camo.githubusercontent.com/ae3f9012ed6b47bc3398a6ae616216cf89649534b7100fde8c72d470f5bfacbc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f7468796e2f7068702d656e756d2d656e68616e63656d656e7473)](https://github.com/othyn/php-enum-enhancements/blob/main/LICENSE)[![Love](https://camo.githubusercontent.com/f6bba0fa49490a2235c41141390255df7c92268a3d0615c429db8342d08b7d5f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230776974682d6c6f76652d726564)](https://img.shields.io/badge/built%20with-love-red)

A [Composer](https://getcomposer.org/) package for [PHP](https://www.php.net/) that adds some helpful enum traits to the glorious new PHP [Enum](https://www.php.net/manual/en/language.enumerations.php) type.

The package so far provides;

- A handy trait that extends PHP's native Enum type
- Adds a new static `UnitEnum::valueArray(): array` method that returns all values within an Enum as an equally typed array of Enum values
- Adds a new static `UnitEnum::valueList(string $separator = ', '): string` method that returns all values within an Enum as a comma separated list string

The package is available on Packagist as [othyn/php-enum-enhancements](https://packagist.org/packages/othyn/php-enum-enhancements).

---

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

[](#installation)

Hop into your project that you wish to install it in and run the following Composer command to grab the latest version:

```
composer require othyn/php-enum-enhancements
```

---

Usage
-----

[](#usage)

For more comprehensive usage examples, you can view the test suite. However I'll show some basic usage examples below.

### Enum: Value Array

[](#enum-value-array)

```
