-
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.String
when the validated value is not a string -
Text.AlphaNumeric
when 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.String
when the validated value is not a string -
Text.Ascii
when 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.String
when the validated value is not a string -
Text.ByteLength
when the validated is not exactlyint
bytes 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.String
when the validated value is not a string -
Text.Length
when the validated value is not exactlyint
UTF-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.String
when the validated value is not a string -
Text.MinimumLength
when the validated value is shorter thanint
UTF-8 characters -
Text.MaximumLength
when the validated value is longer thanint
UTF-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.String
when the validated value is not a string -
Text.MaximumLength
when the validated value is longer thanint
UTF-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.String
when the validated value is not a string -
Text.MinimumLength
when the validated value is shorter thanint
UTF-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.String
when the validated value is not a string -
Text.NoControlCharacters
when the validated value contains control characters