https://github.com/chojnicki/php-enum-generator
Converts list to PHP enum.
https://github.com/chojnicki/php-enum-generator
enum enumerations php php8-features php81 vue vue3
Last synced: 2 months ago
JSON representation
Converts list to PHP enum.
- Host: GitHub
- URL: https://github.com/chojnicki/php-enum-generator
- Owner: chojnicki
- Created: 2022-01-13T18:53:35.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-15T21:36:10.000Z (over 3 years ago)
- Last Synced: 2025-03-08T19:09:16.261Z (2 months ago)
- Topics: enum, enumerations, php, php8-features, php81, vue, vue3
- Language: HTML
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHP Enum generator
Converts list (text with values separated by new lines) to [PHP enum](https://wiki.php.net/rfc/enumerations). You can choose between basic or int/string backed enumerations.
Live version: https://chojnicki.github.io/php-enum-generator
Just reminder - PHP support's native enums from version 8.1!
## Why?
I had to do a lot of enums. For something with couple of values it's not big of a problem, but imagine for example list of countries or currencies 😱 Of course typing this by hand would be too boring. So I decided to write simple Regex for this task, and one thing to another - ended up with this tiny simple app instead. Maybe it will help someone else too, cheers! 🥂
## Features
- Simple or backed enums
- Realtime generation
- Editable PHP file template with indent detection
- Names and values text transformations (uppercase/lowercase)
- Auto incrementation of backed integer values## Usage and contribute
It's written using Vue, but there is no bundlers, depedencies etc. Just single `index.html` file to keep things simple.
So open this file in browser and you are ready to go, or edit it if you need to (PRs are welcomed).License: MIT