Skip to content

Conditions

MohammadAli Arjomand edited this page Aug 1, 2023 · 5 revisions

In Pouria valid you have 2 conditions type

Conditions with value

Like min and max, you must pass value to this conditions like ...

$pouria->conditions([
    "name" => [
        "min=5",
        "max=16"
    ]
]);

In this example 5 is the value of min and 16 is the value of max

Conditions without value

Like required, you don't pass any values to this conditions like ...

$pouria->conditions([
    "name" => [
        "required"
    ]
]);

All Conditions

Title Example Description
Required required Field is required
Minimum min=5 Set minimum length of field
Maximum max=16 Set maximum length of field
Count count=10 Length of field can only be this value
Just just=ABCD Set character(s) on field to just can contains it
No Characters nochar=!@#$%^&* Set character(s) on field to can't contains it
Has has=my name is Set word(s) on field to must contains it
Has Characters haschar=POI Set character(s) on field to must contains anyone
Start start=_token= Field must start with this value
End end=bot Field must end with this value
RegEx regex=/[A-Za-z]+/ Field must match by this regex
E-Mail email Field must be email
Phone phone Field must be phone number
Number number Field must be a number (integer or float)

Only Method

NOTICE This method is just avalable in v1.3.1 or higher

You can register a many fields, if another fields was exists, user get an error

$pouria->only(["username", "password"]);
Clone this wiki locally