Library with general-purpose validation rules.
Run the following command to install the package from Packagist:
composer require cyberfusion/validation-rules
Valid CIDR notation (e.g. 127.0.0.0/32
).
use Cyberfusion\ValidationRules\Rules\Cidr;
public function rules(): array
{
return [
'field' => [new Cidr()],
];
}
Valid common name (e.g. example.com
or sub.example.com
).
use Cyberfusion\ValidationRules\Rules\CommonName;
public function rules(): array
{
return [
'field' => [new CommonName()],
];
}
Valid cron expression (e.g. 0 0 1 1 *
).
use Cyberfusion\ValidationRules\Rules\CronExpression;
public function rules(): array
{
return [
'field' => [new CronExpression()],
];
}
The package includes English and Dutch translations.
Publish them using the following command:
php artisan vendor:publish --provider="Cyberfusion\ValidationRules\ValidationRulesServiceProvider" --tag="translations"