PHPackages                             florianwolters/component-core-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. florianwolters/component-core-enum

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

florianwolters/component-core-enum
==================================

The Typesafe Enum pattern as a PHP component.

v0.4.1(13y ago)0129LGPL-3.0+PHPPHP &gt;=5.4

Since Jul 1Pushed 13y ago1 watchersCompare

[ Source](https://github.com/FlorianWolters/PHP-Component-Core-Enum)[ Packagist](https://packagist.org/packages/florianwolters/component-core-enum)[ Docs](http://github.com/FlorianWolters/PHP-Component-Core-Enum)[ RSS](/packages/florianwolters-component-core-enum/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (7)Versions (5)Used By (0)

FlorianWolters\\Component\\Core\\Enum
=====================================

[](#florianwolterscomponentcoreenum)

[![Build Status](https://camo.githubusercontent.com/72de4fb82fbdc1d002589ab4e8b0745a3aa1bff52087f314f96a5cc1dd6cc6d2/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d456e756d2e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/FlorianWolters/PHP-Component-Core-Enum)

**FlorianWolters\\Component\\Core\\Enum** is a simple-to-use [PHP](http://php.net "PHP: Hypertext Preprocessor") component that provides the *Typesafe Enum* pattern.

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Motivation](#motivation)
- [Features](#features)
- [Requirements](#requirements)
- [Usage](#usage)
- [Installation](#installation)
    - [Local Installation](#local-installation)
    - [System-Wide Installation](#system-wide-installation)
- [As A Dependency On Your Component](#as-a-dependency-on-your-component)
    - [Composer](#composer)
    - [PEAR](#pear)
- [Development Environment](#development-environment)
- [License](#license)

Introduction
------------

[](#introduction)

The [PHP](http://php.net "PHP: Hypertext Preprocessor") scripting language is missing one important data type: **The enumerated type.**

Today, with version 5.4 of the [PHP](http://php.net "PHP: Hypertext Preprocessor") scripting language, there is still no linguistic support for enumerated types. It only exists a Request For Comments (RFC) from [2010-05-21](http://wiki.php.net/rfc/enum "The PHP Group. PHP: rfc:enum [PHP Wiki]. 2001-2013.")) that suggests adding a enum language structure.

Many programming languages, e.g. Pascal, Modula-2, Modula-3, Ada, Haskell, C, C++ und C# have an enumerated type. Java, for example, implements the enumeration type via objects (see [Java Tutorial](http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html "Oracle. The Java Tutorials: Enum Types. 1995, 2013.") and [Java API documentation](http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html "Oracle. Java Platform SE 7: Enum. 1993, 2013.")).

One can use the *`int` Enum* pattern to represent an enumerated type in [PHP](http://php.net "PHP: Hypertext Preprocessor"):

```
