PHPackages                             rikudou/enums-trait - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rikudou/enums-trait

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

rikudou/enums-trait
===================

Trait for creating enums in php

v1.0.2(6y ago)0199WTFPLPHPPHP &gt;=5.4

Since May 30Pushed 6y ago1 watchersCompare

[ Source](https://github.com/RikudouSage/php-enums)[ Packagist](https://packagist.org/packages/rikudou/enums-trait)[ RSS](/packages/rikudou-enums-trait/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

PHP Enums
=========

[](#php-enums)

This is yet another PHP enum implementation.

What is so different about this one? It uses trait which solves one problem all the other implementations I've seen have - extending some base enum class.

All the enums return the same instance for the same enum, so you can check for equality (`===`) and the result is true.

The constructor is made private, so you cannot directly construct an instance via `new` keyword (but you can create an constructor in your class and make it public if you need to, but I advise against it).

Every internal method is made private so you cannot extend the enum (well, you can but it would be useless).

```
