PHPackages                             jomisacu/enumerations - 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. jomisacu/enumerations

ActiveLibrary

jomisacu/enumerations
=====================

A simple way to handle enumerations in php

v1.0.2(3y ago)02.0k↓22.2%MITPHPPHP ^7.1|^8.0

Since Dec 11Pushed 3y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (4)Used By (0)

enumerations
============

[](#enumerations)

A simple class to handle enumerations

why?
----

[](#why)

In some situations we have to handle groups of static values, enumerations comes to deal with these values in a safe way. Instead of write raw values in your code you can use objects, preventing typo errors and behaviour bugs. It is not about wraps values into constants, not, you can use TypeHint to avoid wrong calls in methods and constructors.

Use cases
---------

[](#use-cases)

### Static values: statuses, database enums and options

[](#static-values-statuses-database-enums-and-options)

If you have a currier system you can handle the package states using enumerations: sent, in way, received. Example:

```
