This package provides some additional validation rules for Laravel.
- PHP 8.1 and above
- Laravel 9 or 10
Require this package with composer using the following command:
composer require bbprojectnet/laravel-rulesChecks whether the given string is a base 64 encoded string.
return [
	'attribute' => [new Base64()],
];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
];Checks whether the given filename string has one of the allowed extensions.
return [
	'attribute' => [new Extension(['jpg', 'png', 'gif'])],
];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
];The Laravel rules package is open-sourced software licensed under the MIT license.