1. Go to this page and download the library: Download gzoran/constant 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/ */
gzoran / constant example snippets
class GameStatus extends ConstantAbstract
{
/**
* 定义常量 禁用
*
* @var int
*/
const DISABLE = 0;
/**
* 定义常量 激活
*/
const ACTIVE = 1;
/**
* 这里必须实现常量契约的 mapping 方法,用以配置 “常量” 与 “名称” 的对应关系
*
* @author Mike
* @return array
*/
public static function mapping()
{
return [
self::DISABLE => '已禁用',
self::ACTIVE => '已激活'
];
}
}