@@ -3,70 +3,79 @@ Validate inputs. Open the file "Inp.php" for a lot more validations.
33
44### Initiation
55You will always initiate instace with the static method ** _ val** followed by a value you want to validate.
6- ```
6+
7+ ``` php
78use Validate\Inp;
8- Inp::_values("VALUE")->[VALIDATE_METHOD]();
9+
10+ // Validate option 1
11+ $inp = new Inp("Lorem ipsum dolor");
12+ var_dump($inp->length(1, 200)); // true
13+
14+ // Validate option 2
15+ $valid = Inp::value("Lorem ipsum dolor")->length(1, 200);
16+ var_dump($valid); // true
917```
18+
1019### Check string length is more than or equal to 1
11- ```
12- Inp::_values ("Lorem ipsum dolor")->length(1);
20+ ``` php
21+ Inp::value ("Lorem ipsum dolor")->length(1);
1322```
1423### Check string length is more/equal than 1 and less/equal than 160
15- ```
16- Inp::_values ("Lorem ipsum dolor")->length(1, 160);
24+ ``` php
25+ Inp::value ("Lorem ipsum dolor")->length(1, 160);
1726```
1827### check if is valid email
19- ```
20- Inp::_values ("[email protected] ")->email(); 28+ ``` php
29+ Inp::
value ("
[email protected] ")->email();
2130```
2231### check if is valid phone
2332Will allow only numbers and some characters like (”-”, ”+” and ” ”).
24- ```
25- Inp::_values ("+46709676040")->phone();
33+ ``` php
34+ Inp::value ("+46709676040")->phone();
2635```
2736### Validate Swedish social number (personnummer)
28- ```
29- Inp::_values ("198808213412")->socialNumber();
37+ ``` php
38+ Inp::value ("198808213412")->socialNumber();
3039```
3140### Validate Swedish organisation number
32- ```
33- Inp::_values ("197511043412")->orgNumber();
41+ ``` php
42+ Inp::value ("197511043412")->orgNumber();
3443```
3544### Validate credit card number
36- ```
37- Inp::_values ("1616523623422334")->creditcard();
45+ ``` php
46+ Inp::value ("1616523623422334")->creditcard();
3847```
3948### Validate VAT number
40- ```
41- Inp::_values ("SE8272267913")->vatNumber();
49+ ``` php
50+ Inp::value ("SE8272267913")->vatNumber();
4251```
4352### Check if is a color hex code
44- ```
45- Inp::_values ("#000000")->hex();
53+ ``` php
54+ Inp::value ("#000000")->hex();
4655```
4756### Check date and date format
48- ```
49- Inp::_values ("2022/02/13 14:15")->date(”Y/m/d H:i”);
57+ ``` php
58+ Inp::value ("2022/02/13 14:15")->date(”Y/m/d H:i”);
5059```
5160### Check date, date format and is between a range
52- ```
53- Inp::_values ("2022/02/13 - 2022/02/26")->date(”Y/m/d”);
61+ ``` php
62+ Inp::value ("2022/02/13 - 2022/02/26")->date(”Y/m/d”);
5463```
5564### Check if persons is at least 18 years old or more.
56- ```
57- Inp::_values ("2001/05/22")->age(”18”);
65+ ``` php
66+ Inp::value ("2001/05/22")->age(”18”);
5867```
5968### Check if is a valid domain name
60- ```
61- Inp::_values ("example.com")->domain();
69+ ``` php
70+ Inp::value ("example.com")->domain();
6271```
6372### Check if is a valid URL (http/https is required)
64- ```
65- Inp::_values ("https://example.com/page")->url();
73+ ``` php
74+ Inp::value ("https://example.com/page")->url();
6675```
6776### Check if is a valid DNS
6877Will check compare result against DNS server and match A, AAAA and MX
69- ```
70- Inp::_values ("example.com")->dns();
78+ ``` php
79+ Inp::value ("example.com")->dns();
7180```
7281Open the file for a lot more validations.
0 commit comments