PHP code example of anik / php-enum-enhancements

1. Go to this page and download the library: Download anik/php-enum-enhancements library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

anik / php-enum-enhancements example snippets



# [\UnitEnum | \BackedEnum ]::case->getName(/* null or callable */)
# \BackedEnum::case->getValue(/* null or callable */)
# [\UnitEnum | \BackedEnum ]::names(/* null or callable */)
# \BackedEnum::values(/* null or callable */)
# \BackedEnum::kvPair(
        /* nameCallback: null or callable, */ 
        /* valueCallback: null or callable, */ 
        /* valueAsKey: bool */
#   )

enum PostStatus: string {
    use \Anik\PhpEnumEnhancements\Enhancement;
    
    case DRAFT = 'draft';
    case UNDER_REVIEW = 'under_review';
    case PUBLISHED = 'published';
}