annotation/enumeration
最新稳定版本:v1.0.0
Composer 安装命令:
composer require annotation/enumeration
包简介
Get enum attributes using PHP 8 annotations.
README 文档
README
Get enum attributes using PHP 8 annotations.
Installation
You can install the package via Composer:
composer require annotation/enumeration
use Annotation\Enumeration\Attributes\Enumeration; class User { use HasEnumeration; #[Enumeration([ 'WAIT' => '待审核', 'PASSED' => '成功', 'FAILED' => '失败', ])] public function status() { //return $this->getAttributeEnumeration('status'); } }
$user = new User(); $user->status(); $user->getAttributeEnumerations(); //[ // 'status' => [ // 'wait' => '待审核', // 'passed' => '成功', // 'failed' => '失败', // ], //]; $user->getAttributeEnumeration('status', 'WAIT', '--'); // 待审核 $user->getAttributeEnumeration('status', '', '--'); // -- $user->getEnumeration($user->getAttributeEnumeration('status'), 'PASSED', '--'); // 成功
License
Nacosvel Contracts is made available under the MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 9.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-10