PHP code example of joaorbrandao / phenum

1. Go to this page and download the library: Download joaorbrandao/phenum 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/ */

    

joaorbrandao / phenum example snippets



namespace Acme;

use Joaorbrandao\Phenum\Classes\Enum;
use Joaorbrandao\Phenum\Traits\Enumerable;

class Peripheral extends Enum
{
    use Enumerable;

    const MOUSE = 'mouse';
    const KEYBOARD = 'keyboard';
}



$mouse = Peripheral::MOUSE;


$first = Peripheral::first(); // 'mouse'
$last = Peripheral::last(); // 'keyboard'
$exists = Peripheral::exists('mouse'); // true