1. Go to this page and download the library: Download belca/support-constants 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/ */
$user = Roles::getConst('USER'); // Output: 'user'
$superuser = Roles::getConst('SUPERUSER'); // Output: 'superuser'
$root = Roles::getConst('ROOT'); // Output: null, because it is not defined
$user = Roles::getConst('user'); // Output: null, because the constant was defined in uppercase
namespace App\Enums;
use AnyoneVendor\MyPackage\Enums\Roles as BaseRoles;
class Roles extends BaseRoles
{
// Defines new constants
const VIEWER = 'viewer';
const CHECKER = 'checker';
const TESTER = 'tester';
// Replaces old values of constants
const SUPERUSER = 'root';
const SUPERMODERATOR = 'supermoderator';
}