33### Install
44
55- use composer
6-
7- edit ` composer.json `
6+ - in command: ` composer require inhere/php-validate `
7+ - or edit ` composer.json `
88
99_ require_ add
1010
1111```
12- "inhere/php-validate": "dev-master ",
12+ "inhere/php-validate": "^1.0 ",
1313```
1414
15- _ repositories_ add
16-
17- ```
18- "repositories": [
19- {
20- "type": "git",
21- "url": "https://git.oschina.net/inhere/php-validate"
22- }
23- ]
24- ```
2515
2616run: ` composer update `
2717
@@ -78,7 +68,7 @@ run: `composer update`
7868 ];
7969 }
8070
81- // custom validator message, more {@see ValidationTrait::defaultMessages }
71+ // custom validator message, more {@see ValidationTrait::_defaultMessages }
8272 public function messages()
8373 {
8474 return [
@@ -138,13 +128,13 @@ $valid = Validation::make($_POST,[
138128 // add rule
139129 ['title', 'min', 'min' => 40],
140130 ['freeTime', 'number'],
141- ['title', 'checkTitle', 'msg' => 'Title didn't pass the validate!' ],
131+ ['title', 'checkTitle', 'msg' => 'Title didn\ 't pass the validate!' ],
142132 ])
143133 ->addValidator('checkTitle',function($title){
144134 // some logic ...
145135
146136 return true; // if validate fail, return false.
147- })
137+ }, '{attr} default message!' )
148138 ->validate();
149139
150140```
@@ -159,8 +149,7 @@ $valid = Validation::make($_POST,[
159149
160150// at a subclass of the Validation class
161151<?php
162-
163- '''
152+
164153 public function rules()
165154 {
166155 return [
@@ -195,8 +184,6 @@ $valid = Validation::make($_POST,[
195184
196185// at a subclass of the Validation class
197186<?php
198-
199- '''
200187 public function rules()
201188 {
202189 return [
0 commit comments