Yet Another PHP Enum (YAPE) is a PHP 7+ code generator designed to provide a type-safe, object-backed enum implementation. While there are many existing PHP enum implementations they almost all boil back to some scalar value in a constant and this isn't the type of enum provided by YAPE. The API for generated enums is inspired by Java and if you have worked with Java enums the objects provided by YAPE will feel familiar, if slightly more verbose in their implementation.
We recommend using Composer to install this library.
composer require cspray/yape
Beyond the documentation provided you may execute
vendor/bin/yape <COMMAND_NAME> --help to get assistance with the
The Enum is your code
Although this library aims to reduce the amount of boilerplate and code generation you need to deal with to start using type-safe enums it is important to remember... the Enum is YOUR code. You should look at the code after it is generated and you should modify the code as your needs may change over time.