PHPackages                             ronildo-sousa/enumer - 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. ronildo-sousa/enumer

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

ronildo-sousa/enumer
====================

A simple package to create PHP enum from a json file

v0.0.1(3y ago)06MITPHPPHP ^8.1

Since Apr 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Ronildo-Sousa/enumer)[ Packagist](https://packagist.org/packages/ronildo-sousa/enumer)[ RSS](/packages/ronildo-sousa-enumer/feed)WikiDiscussions main Synced 1mo ago

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

Enumer
======

[](#enumer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/22a7a35a454c4d5d1ae88cd8da88172d467f92f047a2350efea22fba6a66fb59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6e696c646f2d736f7573612f656e756d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ronildo-sousa/enumer)[![Total Downloads](https://camo.githubusercontent.com/998f74dce4c85f90f07f26d73c85d54ba234fe4dcd37583a2f7d1320d4bd7951/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6e696c646f2d736f7573612f656e756d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ronildo-sousa/enumer)

A simple package to create PHP enum from a Json.

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

[](#installation)

You can install the package via composer:

```
composer require ronildo-sousa/enumer
```

Usage
-----

[](#usage)

```
$json = '{"Hearts": "H", "Diamonds": "D", "Clubs": "C", "Spades": "S"}';

$enumer = new RonildoSousa\Enumer();
$enumer->convertJson(json: $json, file_path: '/Enums/Test.php');
```

It will create a class like this:

```
enum Test: string
{

   case Hearts = "H";

   case Diamonds = "D";

   case Clubs = "C";

   case Spades = "S";

}
```

You can change the return type of the enum:

```
$json = '{"Guest": 1, "Editor": 2, "Admin": 3, "Owner": 4}';

$enumer = new RonildoSousa\Enumer();
$enumer->convertJson(json: $json, file_path: '/Enums/Test.php', returnType: 'int');
```

It will create a class like this:

```
enum Test: int
{

   case Guest = 1;

   case Editor = 2;

   case Admin = 3;

   case Owner = 4;

}
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Ronildo Sousa](https://github.com/Ronildo-Sousa)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1119d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/80bea0f9da62dd568d68179bc0c11b318518b0fc50feb5fdd0ffe8d3cfd34392?d=identicon)[Ronildo-Sousa](/maintainers/Ronildo-Sousa)

---

Top Contributors

[![Ronildo-Sousa](https://avatars.githubusercontent.com/u/60019987?v=4)](https://github.com/Ronildo-Sousa "Ronildo-Sousa (16 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ronildo-sousa-enumer/health.svg)

```
[![Health](https://phpackages.com/badges/ronildo-sousa-enumer/health.svg)](https://phpackages.com/packages/ronildo-sousa-enumer)
```

###  Alternatives

[stuttter/wp-user-profiles

A sophisticated way to edit users in WordPress

11219.3k1](/packages/stuttter-wp-user-profiles)[fof/analytics

Tracks analytics using Google Analytics, Google Optimize/GTM and Matomo

3543.1k](/packages/fof-analytics)[chrico/wp-fields

Package which provides some re-usable fields for WordPress.

1981.2k](/packages/chrico-wp-fields)[aertmann/history

An improved history backend module for Neos

1070.2k](/packages/aertmann-history)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
