Skip to content

Commit cd8d54b

Browse files
committed
Merge branch 'release/0.2.0'
2 parents 8d5a06a + cdbc013 commit cd8d54b

File tree

5 files changed

+756
-2
lines changed

5 files changed

+756
-2
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ A collection of common libraries for PHP 7
77

88
##### Methods
99

10+
* `__construct(array $data)` Create Collection
1011
* `set($key, $value)` Add an item
1112
* `get($key, $default = null)` Get value of item; Returns $default if item doesn't exist
1213
* `has($key) : bool` Check if item exists
@@ -18,4 +19,27 @@ A collection of common libraries for PHP 7
1819
* `keys() : array` Get item keys
1920
* `values() : array` Get item values
2021
* `all() : array` Alias for `toArray()`
21-
* `toArray() : array` Returns collection as an array
22+
* `toArray() : array` Returns collection as an array
23+
24+
#### \Noname\Common\Validator
25+
26+
<?php
27+
use \Noname\Common\Validator;
28+
$values = ['email' => '[email protected]'];
29+
$rules = ['email' => 'email'];
30+
$validator = new Validator($values, $rules);
31+
$valid = $validator->validate();
32+
if(!$valid){
33+
print_r($validator->getErrors());
34+
}
35+
36+
##### Methods
37+
38+
* `__construct(array $data, array $rules, array $settings = [])` Create Validator
39+
* $data : array
40+
* $rules : array
41+
* $settings : array
42+
* `validate() : bool` Validate data based on supplied rules
43+
* `hasErrors() : bool` Check if validator has errors
44+
* `getErrors() : array` Return validation errors
45+
* `validateType($type, $value, array $rule = []) : bool` Type-specific validator

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nonamephp/common",
33
"description": "A collection of common PHP 7 libraries",
4-
"version": "0.1.4",
4+
"version": "0.2.0",
55
"license": "MIT",
66
"authors": [
77
{

0 commit comments

Comments
 (0)