https://github.com/pgyf/php-utils
php积累的一些公用类方法
https://github.com/pgyf/php-utils
common php php-utils utils
Last synced: 11 months ago
JSON representation
php积累的一些公用类方法
- Host: GitHub
- URL: https://github.com/pgyf/php-utils
- Owner: pgyf
- License: mit
- Created: 2020-08-13T05:40:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-08T02:21:09.000Z (almost 5 years ago)
- Last Synced: 2025-01-23T06:45:11.814Z (about 1 year ago)
- Topics: common, php, php-utils, utils
- Language: PHP
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-utils
php积累的一些公用类方法
# 环境支持
php版本 >= PHP 7.1
安装
------------
```
composer require phpyii/php-utils
//开发版本
composer require phpyii/php-utils:dev-master
```
# 枚举类使用方法
```php
class statusEnum extends \phpyii\utils\Enum{
const VIEW = 'view';
const EDIT = 'edit';
protected static function labels(): array {
return [
self::VIEW => '视图',
];
}
}
//枚举值
$viewAction = statusEnum::VIEW();
$viewAction->getValue();
//或者
statusEnum::VIEW;
//获取枚举label
statusEnum::getLabelByValue(statusEnum::VIEW);
//获取枚举 值=>label数组
statusEnum::toArray();
```