-
Notifications
You must be signed in to change notification settings - Fork 2
Text
Validates the input (string) to only contain alpha numeric characters.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Text\AlphaNumeric;
(new AlphaNumeric())->validate('Lipsum 123');-
Type.Stringwhen the validated value is not a string -
Text.AlphaNumericwhen the validated value contains non alpha numeric characters
Validates the input (string) to only contain ASCII characters.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Text\Ascii;
(new Ascii())->validate('Lipsum 123');-
Type.Stringwhen the validated value is not a string -
Text.Asciiwhen the validated value contains non ASCII characters
Validates the input (string) to be exactly bytes (int) long.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Text\ByteLength;
(new ByteLength(6))->validate('Lipsum');-
Type.Stringwhen the validated value is not a string -
Text.ByteLengthwhen the validated is not exactlyintbytes long
Validates the input (string) to be exactly (int) UTF-8 characters long.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Text\Length;
(new Length(6))->validate('€€');-
Type.Stringwhen the validated value is not a string -
Text.Lengthwhen the validated value is not exactlyintUTF-8 characters long
Validates the input (string) to be within the range of (int) minimum UTF-8 characters and (int) maximum UTF-8 characters.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Text\LengthRange;
(new LengthRange(1, 10))->validate('€€');-
Type.Stringwhen the validated value is not a string -
Text.MinimumLengthwhen the validated value is shorter thanintUTF-8 characters -
Text.MaximumLengthwhen the validated value is longer thanintUTF-8 characters
Validates the input (string) to be shorter than or exactly (int) maximum UTF-8 characters.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Text\MaximumLength;
(new MaximumLength(10))->validate('€€');-
Type.Stringwhen the validated value is not a string -
Text.MaximumLengthwhen the validated value is longer thanintUTF-8 characters
Validates the input (string) to be longer than or exactly (int) minimum UTF-8 characters.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Text\MinimumLength;
(new MinimumLength(1))->validate('€€');-
Type.Stringwhen the validated value is not a string -
Text.MinimumLengthwhen the validated value is shorter thanintUTF-8 characters
Validates the input (string) to not contain any control characters.
Available since: 1.0.0
<?php declare(strict_types);
use HarmonyIO\Validation\Rule\Text\NoControlCharacters;
(new NoControlCharacters())->validate('Lipsum €€');-
Type.Stringwhen the validated value is not a string -
Text.NoControlCharacterswhen the validated value contains control characters