Skip to content

Commit 3a66c56

Browse files
Update README.md
1 parent b4ba0d3 commit 3a66c56

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use Validator\Validator;
2323

2424
$validator = new Validator();
2525

26+
//Set data validation rules
2627
$validator->rules([
2728
'first_name' => [
2829
'required' => true,
@@ -59,6 +60,7 @@ use Validator\Validator;
5960

6061
$validator = new Validator();
6162

63+
//Set data validation rules
6264
$validator->rules([
6365
'first_name,last_name' => 'required|not_null|string',
6466
'email' => 'required|not_null|email',
@@ -76,6 +78,7 @@ use Validator\Validator;
7678

7779
$validator = new Validator();
7880

81+
//Set validation error messages
7982
$validator->messages([
8083
'first_name' => [
8184
'required' => 'First name is required',
@@ -112,7 +115,8 @@ use Validator\Validator;
112115

113116
$validator = new Validator();
114117

115-
$validator->rules([
118+
//Set validation error messages
119+
$validator->messages([
116120
'first_name,last_name' => 'required:Name is required|not_null:Name can not be null|string:Name should be in string',
117121
'email' => 'required:Email is required|not_null:Email can not be null|email:Please enter valid email address',
118122
'gender' => 'required:Gender is required|not_null:Gender can not be null|in:Please select valid gender'
@@ -121,7 +125,7 @@ $validator->rules([
121125
```
122126

123127
### Validate Data
124-
Using validator we can validate form-data, array, object and json data. we validate data using `validate` method. if all data is valid then it will return `true` otherwise it will return `false`.
128+
Using validator we can validate html form-data, array, object and json data. Validator validate data according to rules. It will return `true` if all the data are valid, otherwise it will return `false`.
125129

126130
```php
127131
use Validator\Validator;

0 commit comments

Comments
 (0)