cyberfusion / validation-rules
Library with general-purpose validation rules.
v1.1.0
2024-08-14 11:52 UTC
Requires
- php: ^8.3
- dragonmantank/cron-expression: ^3.3
- illuminate/support: ^10.12|^11.0
- s1lentium/iptools: ^1.2
Requires (Dev)
- orchestra/testbench: ^8.5|^9.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.1|^11.0
- symplify/easy-coding-standard: ^12.0
README
Library with general-purpose validation rules.
Install
Composer
Run the following command to install the package from Packagist:
composer require cyberfusion/validation-rules
Usage
Rules
Cidr
Valid CIDR notation (e.g. 127.0.0.0/32
).
use Cyberfusion\ValidationRules\Rules\Cidr; public function rules(): array { return [ 'field' => [new Cidr()], ]; }
CommonName
Valid common name (e.g. example.com
or sub.example.com
).
use Cyberfusion\ValidationRules\Rules\CommonName; public function rules(): array { return [ 'field' => [new CommonName()], ]; }
CronExpression
Valid cron expression (e.g. 0 0 1 1 *
).
use Cyberfusion\ValidationRules\Rules\CronExpression; public function rules(): array { return [ 'field' => [new CronExpression()], ]; }
Translations
The package includes English and Dutch translations.
Publish them using the following command:
php artisan vendor:publish --provider="Cyberfusion\ValidationRules\ValidationRulesServiceProvider" --tag="translations"