PHP code example of kongulov / interact-with-enum
1. Go to this page and download the library: Download kongulov/interact-with-enum 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/ */
kongulov / interact-with-enum example snippets
namespace App\Enums;
use Kongulov\Traits\InteractWithEnum;
enum StatusEnum: string {
use InteractWithEnum;
case Pending = 'pending';
case Active = 'active';
case Inactive = 'inactive';
}
StatusEnum::names()
StatusEnum::values()
StatusEnum::array()
StatusEnum::find('Active') // Find by name
StatusEnum::find('active') // Find by value