Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ $this->assertTrue($v->validate());
* `url` - Valid URL
* `urlActive` - Valid URL with active DNS record
* `alpha` - Alphabetic characters only
* `alphaSpace` - Alphabetic characters and whitespace only
* `alphaNum` - Alphabetic and numeric characters only
* `alphaNumSpace` - Alphabetic, numeric, and whitespace characters only
* `ascii` - ASCII characters only
* `slug` - URL slug characters (a-z, 0-9, -, \_)
* `regex` - Field matches given regex pattern
Expand Down Expand Up @@ -806,6 +808,23 @@ $v->rules([
$v->validate();
```

## alphaSpace fields usage
The `alphaSpace` rule checks the field is alphabetic characters and whitespace only.
```php
$v->rule('alphaSpace', 'name');
```

Alternate syntax.
```php
$v = new Valitron\Validator(['name' => 'Bruce Wayne']);
$v->rules([
'alphaSpace' => [
['name']
]
]);
$v->validate();
```

## alphaNum fields usage
The `alphaNum` rule checks the field contains only alphabetic or numeric characters.
```php
Expand All @@ -823,6 +842,22 @@ $v->rules([
$v->validate();
```

## alphaNumSpace fields usage
The `alphaNumSpace` rule checks the field contains only alphabetic, numeric, and whitespace characters.
```php
$v->rule('alphaNumSpace', 'street');
```

Alternate syntax.
```php
$v = new Valitron\Validator(['street' => 'Wayne Manor 1']);
$v->rules([
'alphaNumSpace' => [
['street']
]
]);
$v->validate();
```
## ascii fields usage
The `ascii` rule checks the field contains only characters in the ascii character set.
```php
Expand Down
2 changes: 2 additions & 0 deletions lang/ar.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "الرابط غير صحيح",
'urlActive' => "يجب أن يكون نطاق فعال",
'alpha' => "يجب أن يحتوي فقط علي a-z",
'alphaSpace' => "يجب أن يحتوي فقط علي a-z",
'alphaNum' => "يجب ان يحتوي فقط a-z او ارقام 0-9",
'alphaNumSpace' => "يجب ان يحتوي فقط a-z او ارقام 0-9",
'slug' => "يجب ان يحتوي فقط علي a-z, و ارقام 0-9, شرطات و خط سفلي",
'regex' => "خطا بالصيغة",
'date' => "خطا بالتاريخ",
Expand Down
2 changes: 2 additions & 0 deletions lang/az.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "URL deyil",
'urlActive' => "aktiv domain olmalıdır",
'alpha' => "ancaq latın hərfləri ehtiva etməlidir",
'alphaSpace' => "ancaq latın hərfləri ehtiva etməlidir",
'alphaNum' => "ancaq latın hərfləri və(və ya) rəqəmlər ehtiva etməlidir",
'alphaNumSpace' => "ancaq latın hərfləri və(və ya) rəqəmlər ehtiva etməlidir",
'slug' => "ancaq latın hərfləri,rəqəmlər,tire və altdan xət ehtiva etməlidir",
'regex' => "etiabrsız sinvollar ehtiva edir",
'date' => "tarix deyil",
Expand Down
2 changes: 2 additions & 0 deletions lang/bg.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "е невалиден URL адрес",
'urlActive' => "трябва да бъде активен домейн",
'alpha' => "трябва да съдържа само букви a-z",
'alphaSpace' => "трябва да съдържа само букви a-z",
'alphaNum' => "трябва да съдържа само букви a-z и/или цифри 0-9",
'alphaNumSpace' => "трябва да съдържа само букви a-z и/или цифри 0-9",
'slug' => "трябва да съдържа само букви a-z, цифри 0-9, тирета и долни черти",
'regex' => "съдържа невалидни символи",
'date' => "е невалидна дата",
Expand Down
2 changes: 2 additions & 0 deletions lang/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "enthält keine gültige URL",
'urlActive' => "muss eine aktive Domain sein",
'alpha' => "darf nur Buchstaben enthalten",
'alphaSpace' => "darf nur Buchstaben enthalten",
'alphaNum' => "darf nur Buchstaben und Ganzzahlen enthalten",
'alphaNumSpace' => "darf nur Buchstaben und Ganzzahlen enthalten",
'slug' => "darf nur Buchstaben, Ganzzahlen, Schrägstriche und Grundstriche enthalten",
'regex' => "enthält ungültige Zeichen",
'date' => "enthält kein gültiges Datum",
Expand Down
2 changes: 2 additions & 0 deletions lang/el.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "δεν είναι URL",
'urlActive' => "πρέπει να είναι ενεργό domain",
'alpha' => "πρέπει να περιέχει μόνο χαρακτήρες",
'alphaSpace' => "πρέπει να περιέχει μόνο χαρακτήρες",
'alphaNum' => "πρέπει να περιέχει μόνο χαρακτήρες και/ή αριθμούς",
'alphaNumSpace' => "πρέπει να περιέχει μόνο χαρακτήρες και/ή αριθμούς",
'slug' => "πρέπει να περιέχει μόνο χαρακτήρες, αριθμούς, παύλες και κάτω παύλες",
'regex' => "περιέχει μη έγκυρους χαρακτήρες",
'date' => "δεν είναι έγκυρη ημερομηνία",
Expand Down
2 changes: 2 additions & 0 deletions lang/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
'url' => "is not a valid URL",
'urlActive' => "must be an active domain",
'alpha' => "must contain only letters a-z",
'alphaSpace' => "must contain only letters a-z",
'alphaNum' => "must contain only letters a-z and/or numbers 0-9",
'alphaNumSpace' => "must contain only letters a-z and/or numbers 0-9",
'slug' => "must contain only letters a-z, numbers 0-9, dashes and underscores",
'regex' => "contains invalid characters",
'date' => "is not a valid date",
Expand Down
2 changes: 2 additions & 0 deletions lang/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
'url' => "no es una URL",
'urlActive' => "debe ser un dominio activo",
'alpha' => "debe contener solo letras a-z",
'alphaSpace' => "debe contener solo letras a-z",
'alphaNum' => "debe contener solo letras a-z o números 0-9",
'alphaNumSpace' => "debe contener solo letras a-z o números 0-9",
'slug' => "debe contener solo letras a-z, números 0-9, barras y guiones bajos",
'regex' => "contiene caracteres inválidos",
'date' => "no es una fecha válida",
Expand Down
2 changes: 2 additions & 0 deletions lang/fi.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "ei ole URL",
'urlActive' => "ei ole aktiivinen verkkotunnus",
'alpha' => "sisältää muita merkkejä kuin a-z",
'alphaSpace' => "sisältää muita merkkejä kuin a-z",
'alphaNum' => "sisältää muita merkkejä kuin a-z ja 0-9",
'alphaNumSpace' => "sisältää muita merkkejä kuin a-z ja 0-9",
'slug' => "sisältää muita merkkejä kuin a-z, 0-9, - ja _",
'regex' => "sisältää virheellisiä merkkejä",
'date' => "ei ole oikeanmuotoinen päivämäärä",
Expand Down
2 changes: 2 additions & 0 deletions lang/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "n'est pas une URL",
'urlActive' => "doit être un domaine actif",
'alpha' => "doit contenir uniquement les lettres a-z",
'alphaSpace' => "doit contenir uniquement les lettres a-z",
'alphaNum' => "doit contenir uniquement des lettres de a-z et/ou des chiffres 0-9",
'alphaNumSpace' => "doit contenir uniquement des lettres de a-z et/ou des chiffres 0-9",
'slug' => "doit contenir uniquement des lettres de a-z, des chiffres 0-9, des tirets et des traits soulignés",
'regex' => "contient des caractères invalides",
'date' => "n'est pas une date valide",
Expand Down
2 changes: 2 additions & 0 deletions lang/id.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "bukan format URL yang benar",
'urlActive' => "harus berupa domain aktif",
'alpha' => "hanya boleh menggunakan huruf a-z",
'alphaSpace' => "hanya boleh menggunakan huruf a-z",
'alphaNum' => "hanya boleh menggunakan huruf a-z dan atau nomor 0-9",
'alphaNumSpace' => "hanya boleh menggunakan huruf a-z dan atau nomor 0-9",
'slug' => "hanya boleh menggunakan huruf a-z, nomor 0-9, tanda minus (-), dan uderscore atau strip bawah (_)",
'regex' => "berisi karakter yang tidak valid",
'date' => "format tanggal tidak valid",
Expand Down
2 changes: 2 additions & 0 deletions lang/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "non è una URL",
'urlActive' => "deve essere un dominio attivo",
'alpha' => "deve contenere solamente lettere (a-z)",
'alphaSpace' => "deve contenere solamente lettere (a-z)",
'alphaNum' => "deve contenere solamente lettere (a-z) e/o numeri (0-9)",
'alphaNumSpace' => "deve contenere solamente lettere (a-z) e/o numeri (0-9)",
'slug' => "deve contenere solamente lettere (a-z), numeri (0-9), trattini (-) e trattini bassi (_)",
'regex' => "contiene caratteri non validi",
'date' => "non è una data valida",
Expand Down
2 changes: 2 additions & 0 deletions lang/ja.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "はURLの書式として正しくありません",
'urlActive' => "はアクティブなドメインではありません",
'alpha' => "は半角英字で入力してください",
'alphaSpace' => "は半角英字で入力してください",
'alphaNum' => "は半角英数字で入力してください",
'alphaNumSpace' => "は半角英数字で入力してください",
'slug' => "は半角英数字、もしくは「-」「_」の文字で入力してください",
'regex' => "の書式が正しくありません",
'date' => "は日付の書式として正しくありません",
Expand Down
2 changes: 2 additions & 0 deletions lang/ko.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "은(는) 올바르지 않은 URL입니다.",
'urlActive' => "은(는) 접속 가능한 도메인이어야 합니다.",
'alpha' => "은(는) 영문자(a-z)로만 이루어져야 합니다.",
'alphaSpace' => "은(는) 영문자(a-z)로만 이루어져야 합니다.",
'alphaNum' => "은(는) 영문자(a-z)와 숫자(0-9)로만 이루어져야 합니다.",
'alphaNumSpace' => "은(는) 영문자(a-z)와 숫자(0-9)로만 이루어져야 합니다.",
'slug' => "은(는) 영문자(a-z)와 숫자(0-9), 특수문자 -와 _로만 이루어져야 합니다.",
'regex' => "은(는) 올바르지 않은 문자를 포함하고 있습니다.",
'date' => "은(는) 올바르지 않은 날짜입니다.",
Expand Down
2 changes: 2 additions & 0 deletions lang/lt.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
'url' => "nėra teisingas URL",
'urlActive' => "turi būti aktyvus domenas",
'alpha' => "turi turėti tik raides a-ž",
'alphaSpace' => "turi turėti tik raides a-ž",
'alphaNum' => "turi turėti tik raides a-ž ir/ar skaičius 0-9",
'alphaNumSpace' => "turi turėti tik raides a-ž ir/ar skaičius 0-9",
'slug' => "turi turėti tik raides a-ž, skaičius 0-9, brukšnelius ir apatinius brukšnelius",
'regex' => "yra neteisingų ženklų",
'date' => "nėra teisinga data",
Expand Down
2 changes: 2 additions & 0 deletions lang/lv.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "lauks nav tīmekļa saite",
'urlActive' => "saite neatrodas esošajā domēna vārdā",
'alpha' => "lauks var saturēt tikai alfabēta burtus a-z",
'alphaSpace' => "lauks var saturēt tikai alfabēta burtus a-z",
'alphaNum' => "lauks var saturēt tikai alfabēta burtus un/vai ciparus 0-9",
'alphaNumSpace' => "lauks var saturēt tikai alfabēta burtus un/vai ciparus 0-9",
'slug' => "lauks var saturēt tikai alfabēta burtus un/vai ciparus 0-9, domuzīmes and zemsvītras",
'regex' => "lauks satur nederīgus simbolus",
'date' => "lauks ir nederīgā datuma formātā",
Expand Down
2 changes: 2 additions & 0 deletions lang/nb.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
'url' => "er ikke en gyldig URL",
'urlActive' => "må være et aktivt domene",
'alpha' => "må bare innholde bokstaver a-z",
'alphaSpace' => "må bare innholde bokstaver a-z",
'alphaNum' => "må bare innholde bokstaver a-z og/eller tall 0-9",
'alphaNumSpace' => "må bare innholde bokstaver a-z og/eller tall 0-9",
'slug' => "må bare innholde bokstaver a-z og/eller tall 0-9, bindestreker og understreker",
'regex' => "inneholder ulovlige tegn",
'date' => "er ikke en gyldig dato",
Expand Down
2 changes: 2 additions & 0 deletions lang/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "is geen geldige URL",
'urlActive' => "moet een actief domein zijn",
'alpha' => "mag enkel letters (a-z) bevatten",
'alphaSpace' => "mag enkel letters (a-z) bevatten",
'alphaNum' => "mag enkel letters (a-z) en/of cijfers (0-9) bevatten",
'alphaNumSpace' => "mag enkel letters (a-z) en/of cijfers (0-9) bevatten",
'slug' => "mag enkel letters (a-z), cijfers (0-9) en liggende streepjes (_,-) bevatten",
'regex' => "bevat ongeldige karakters",
'date' => "is geen geldige datum",
Expand Down
2 changes: 2 additions & 0 deletions lang/nn.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "er ikkje ein gyldig URL",
'urlActive' => "må være eit aktivt domene",
'alpha' => "må bare innholde bokstaver a-z",
'alphaSpace' => "må bare innholde bokstaver a-z",
'alphaNum' => "må bare innholde bokstaver a-z og/eller tall 0-9",
'alphaNumSpace' => "må bare innholde bokstaver a-z og/eller tall 0-9",
'slug' => "må bare innholde bokstaver a-z og/eller tall 0-9, bindestreker og understreker",
'regex' => "inneholder ulovlige tegn",
'date' => "er ikkje ein gylid dato",
Expand Down
2 changes: 2 additions & 0 deletions lang/pl.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "nie jest URL",
'urlActive' => "musi być aktywną domeną",
'alpha' => "musi zawierać tylko litery a-z",
'alphaSpace' => "musi zawierać tylko litery a-z",
'alphaNum' => "musi zawierać tylko litery a-z i/lub cyfry 0-9",
'alphaNumSpace' => "musi zawierać tylko litery a-z i/lub cyfry 0-9",
'slug' => "musi zawierać tylko litery a-z i/lub cyfry 0-9, myślinik I podkreślnik",
'regex' => "zawiera nieprawidłowe znaki",
'date' => "nie jest prawidłową datą",
Expand Down
2 changes: 2 additions & 0 deletions lang/pt-br.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
'url' => "não é uma URL válida",
'urlActive' => "deve ser um domínio ativo",
'alpha' => "deve conter as letras a-z",
'alphaSpace' => "deve conter as letras a-z",
'alphaNum' => "deve conter apenas letras a-z e/ou números 0-9",
'alphaNumSpace' => "deve conter apenas letras a-z e/ou números 0-9",
'slug' => "deve conter apenas letras a-z, números 0-9, ou os caracteres - ou _",
'regex' => "contém caracteres inválidos",
'date' => "não é uma data válida",
Expand Down
2 changes: 2 additions & 0 deletions lang/ro.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "nu este un URL",
'urlActive' => "trebuie sa fie un domeniu activ",
'alpha' => "trebuie sa contina doar litere de la a-z",
'alphaSpace' => "trebuie sa contina doar litere de la a-z",
'alphaNum' => "trebuie sa contina doar numere de la a-z si/sau numere 0-9",
'alphaNumSpace' => "trebuie sa contina doar numere de la a-z si/sau numere 0-9",
'slug' => "trebuie sa contina doar litere de la a-z, numere de la 0-9, cratime si underline '_'",
'regex' => "contine caractere invalide",
'date' => "nu este o data valida",
Expand Down
2 changes: 2 additions & 0 deletions lang/ru.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
'url' => "не является валидной ссылкой",
'urlActive' => "содержит не активную ссылку",
'alpha' => "должно содержать только латинские символы",
'alphaSpace' => "должно содержать только латинские символы",
'alphaNum' => "должно содержать только латинские символы и/или цифры",
'alphaNumSpace' => "должно содержать только латинские символы и/или цифры",
'slug' => "должно содержать только латинские символы, цифры, тире и подчёркивания",
'regex' => "содержит недопустимые символы",
'date' => "не является датой",
Expand Down
2 changes: 2 additions & 0 deletions lang/sk.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "nie je URL",
'urlActive' => "musí byť aktívna URL",
'alpha' => "musí obsahovať len písmená a-z",
'alphaSpace' => "musí obsahovať len písmená a-z",
'alphaNum' => "musí obsahovať len písmená a-z a/alebo čísla 0-9",
'alphaNumSpace' => "musí obsahovať len písmená a-z a/alebo čísla 0-9",
'slug' => "musí obsahovať len písmená a-z, čísla 0-9, pomlčky alebo podtržítka",
'regex' => "obsahuje nepovolené znaky",
'date' => "nie je korektný formáť",
Expand Down
2 changes: 2 additions & 0 deletions lang/sl.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
'url' => "ni veljaven URL",
'urlActive' => "mora biti aktivna domena",
'alpha' => "mora vsebovati samo črke a-z",
'alphaSpace' => "mora vsebovati samo črke a-z",
'alphaNum' => "mora vsebovati samo črke a-z in / ali številke 0-9",
'alphaNumSpace' => "mora vsebovati samo črke a-z in / ali številke 0-9",
'slug' => "mora vsebovati samo črke a-z, številke 0-9, črtice in podčrtaje",
'regex' => "vsebuje neveljavne znake",
'date' => "ni veljaven datum",
Expand Down
2 changes: 2 additions & 0 deletions lang/sv.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "är inte en giltlig URL",
'urlActive' => "måste vara ett aktivt domännamn",
'alpha' => "får bara inehålla bokstäver a-z",
'alphaSpace' => "får bara inehålla bokstäver a-z",
'alphaNum' => "får bara inehålla bokstäver a-z och/eller siffror 0-9",
'alphaNumSpace' => "får bara inehålla bokstäver a-z och/eller siffror 0-9",
'slug' => "får bara inehålla bokstäver a-z och/eller siffror 0-9, bindesträck og understräck",
'regex' => "inehåller ogiltliga tecken",
'date' => "är inte ett giltligt datum",
Expand Down
2 changes: 2 additions & 0 deletions lang/th.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "ไม่ใช่ลิงก์",
'urlActive' => "ต้องไม่ใช่โดเมนที่ใช้งานอยู่",
'alpha' => "ต้องมีแค่ตัวอักษร a-z",
'alphaSpace' => "ต้องมีแค่ตัวอักษร a-z",
'alphaNum' => "ต้องมีแค่ตัวอักษร a-z และ/หรือ ตัวเลข 0-9",
'alphaNumSpace' => "ต้องมีแค่ตัวอักษร a-z และ/หรือ ตัวเลข 0-9",
'slug' => "ต้องมีแค่ตัวอักษร a-z ตัวเลข 0-9 / และ _",
'regex' => "มีตัวอักษรที่ไม่ถูกต้อง",
'date' => "ไม่ใช่วันที่ที่ถูกต้อง",
Expand Down
2 changes: 2 additions & 0 deletions lang/tr.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'url' => "bir URL değil",
'urlActive' => "aktif bir alan adı olmalı",
'alpha' => "sadece harf içermeli a-z",
'alphaSpace' => "sadece harf içermeli a-z",
'alphaNum' => "sadece harf (a-z) ve/veya sayılar (0-9) içermeli",
'alphaNumSpace' => "sadece harf (a-z) ve/veya sayılar (0-9) içermeli",
'slug' => "sadece harf (a-z), numbers sayılar (0-9), tire ve alt tire içermeli",
'regex' => "geçersiz karakterler içeriyor",
'date' => "geçerli bir karakter değil",
Expand Down
Loading