muffe/enum-constraint
最新稳定版本:v0.2.1
Composer 安装命令:
composer require muffe/enum-constraint
包简介
A Symfony Validator constraint that validates if given strings are valid cases in a given PHP 8 Enum
README 文档
README
A Symfony Validator constraint that validates if given strings are valid cases in a given PHP 8 Enum
enum ContactCategory: string
{
case Child = 'Child';
case Grandchild = 'Grandchild';
}
use Muffe\EnumConstraint\Constraints\Enum;
#[
Enum(
enumType: ContactCategory::class,
)
]
public ?string $category = null;
Validates that $category contains a string that is equal to the backed value of one of the given enum cases, or the name of the case if no backed values are given.
use Muffe\EnumConstraint\Constraints\Enum;
#[
Enum(
enumType: ContactCategory::class,
multiple: true
)
]
public ?array $categories = null;
Also supports validating multiple given values
统计信息
- 总下载量: 10.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-05