1. Go to this page and download the library: Download sebastiaanluca/php-helpers 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/ */
use SebastiaanLuca\PhpHelpers\Classes\Enum;
class UserStates
{
use Enum;
public const REGISTERED = 'registered';
public const ACTIVATED = 'activated';
public const DISABLED = 'disabled';
}
UserStates::enums();
// or
(new UserStates)->enums();
/*
[
"REGISTERED" => "registered",
"ACTIVATED" => "activated",
"DISABLED" => "disabled",
]
*/
use SebastiaanLuca\PhpHelpers\Classes\Enum;
class UserStates
{
use Enum;
public const REGISTERED = 'registered';
public const ACTIVATED = 'activated';
public const DISABLED = 'disabled';
}
UserStates::keys();
/*
[
"REGISTERED",
"ACTIVATED",
"DISABLED",
]
*/
use SebastiaanLuca\PhpHelpers\Classes\Enum;
class UserStates
{
use Enum;
public const REGISTERED = 'registered';
public const ACTIVATED = 'activated';
public const DISABLED = 'disabled';
}
UserStates::values();
/*
[
"registered",
"activated",
"disabled",
]
*/
namespace Kyle\Helpers;
use SebastiaanLuca\PhpHelpers\Classes\ProvidesClassInfo;
class MyClass
{
use ProvidesClassInfo;
public function __construct()
{
var_dump($this->getClassDirectory());
}
}
// "/Users/Kyle/Projects/php-helpers"