bbprojectnet/laravel-rules
最新稳定版本:1.0.2
Composer 安装命令:
composer require bbprojectnet/laravel-rules
包简介
Additional rules classes for Laravel.
README 文档
README
This package provides some additional validation rules for Laravel.
Requirements
- PHP 8.1 and above
- Laravel 9 or 10
Installation
Require this package with composer using the following command:
composer require bbprojectnet/laravel-rules
Rules
Base64
Checks whether the given string is a base 64 encoded string.
return [ 'attribute' => [new Base64()], ];
EnumCase
Checks if the given string is one of the enum cases.
return [ 'attribute' => [new EnumCase(Color::class)], // any enum case 'attribute' => [new EnumCase([Color::Red, Color::Blue])], // selected enum cases ];
Extension
Checks whether the given filename string has one of the allowed extensions.
return [ 'attribute' => [new Extension(['jpg', 'png', 'gif'])], ];
ManyOf
Checks whether the values given in a string (separated, for example, by a comma) meet the specified rule.
$rule = new Extension(['jpg', 'png']); return [ 'attribute' => [new ManyOf($rule)], 'attribute' => [(new ManyOf($rule))->delimeter('|')], // with custom delimeter ];
License
The Laravel rules package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 900
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-24