Skip to content

Commit 55eaa23

Browse files
committed
Rename package
1 parent 29febd9 commit 55eaa23

File tree

101 files changed

+253
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+253
-247
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Using `make`:
4444

4545
require('vendor/autoload.php');
4646

47-
use DG\Validation\Validator;
47+
use IgniteKit\Validation\Validator;
4848

4949
$validator = new Validator;
5050

@@ -84,7 +84,7 @@ or just `validate` it:
8484

8585
require('vendor/autoload.php');
8686

87-
use DG\Validation\Validator;
87+
use IgniteKit\Validation\Validator;
8888

8989
$validator = new Validator;
9090

@@ -303,7 +303,7 @@ $message = $validation->errors()->first('nomor'); // "Nomor hanya memperbolehkan
303303
304304
## Working with Error Message
305305

306-
Errors messages are collected in `DG\Validation\ErrorBag` object that you can get it using `errors()` method.
306+
Errors messages are collected in `IgniteKit\Validation\ErrorBag` object that you can get it using `errors()` method.
307307

308308
```php
309309
$validation = $validator->validate($inputs, $rules);
@@ -926,15 +926,15 @@ $validation = $validator->validate($_POST, [
926926
]);
927927
```
928928

929-
> Note: `DG\Validation\Rules\Callback` instance is binded into your Closure.
929+
> Note: `IgniteKit\Validation\Rules\Callback` instance is binded into your Closure.
930930
So you can access rule properties and methods using `$this`.
931931

932932
</details>
933933

934934

935935
## Register/Override Rule
936936

937-
Another way to use custom validation rule is to create a class extending `DG\Validation\Rule`.
937+
Another way to use custom validation rule is to create a class extending `IgniteKit\Validation\Rule`.
938938
Then register it using `setValidator` or `addValidator`.
939939

940940
For example, you want to create `unique` validator that check field availability from database.
@@ -944,7 +944,7 @@ First, lets create `UniqueRule` class:
944944
```php
945945
<?php
946946

947-
use DG\Validation\Rule;
947+
use IgniteKit\Validation\Rule;
948948

949949
class UniqueRule extends Rule
950950
{
@@ -989,7 +989,7 @@ class UniqueRule extends Rule
989989
Then you need to register `UniqueRule` instance into validator like this:
990990

991991
```php
992-
use DG\Validation\Validator;
992+
use IgniteKit\Validation\Validator;
993993

994994
$validator = new Validator;
995995

@@ -1004,7 +1004,7 @@ $validation = $validator->validate($_POST, [
10041004
]);
10051005
```
10061006

1007-
In `UniqueRule` above, property `$message` is used for default invalid message. And property `$fillable_params` is used for `fillParameters` method (defined in `DG\Validation\Rule` class). By default `fillParameters` will fill parameters listed in `$fillable_params`. For example `unique:users,email,[email protected]` in example above, will set:
1007+
In `UniqueRule` above, property `$message` is used for default invalid message. And property `$fillable_params` is used for `fillParameters` method (defined in `IgniteKit\Validation\Rule` class). By default `fillParameters` will fill parameters listed in `$fillable_params`. For example `unique:users,email,[email protected]` in example above, will set:
10081008

10091009
```php
10101010
$params['table'] = 'users';
@@ -1031,7 +1031,7 @@ So you can improve `UniqueRule` class above by adding some methods that returnin
10311031
```php
10321032
<?php
10331033

1034-
use DG\Validation\Rule;
1034+
use IgniteKit\Validation\Rule;
10351035

10361036
class UniqueRule extends Rule
10371037
{
@@ -1080,7 +1080,7 @@ To make your custom rule implicit, you can make `$implicit` property value to be
10801080
```php
10811081
<?php
10821082

1083-
use DG\Validation\Rule;
1083+
use IgniteKit\Validation\Rule;
10841084

10851085
class YourCustomRule extends Rule
10861086
{
@@ -1094,15 +1094,15 @@ class YourCustomRule extends Rule
10941094

10951095
In some case, you may want your custom rule to be able to modify it's attribute value like our `default/defaults` rule. So in current and next rules checks, your modified value will be used.
10961096

1097-
To do this, you should implements `DG\Validation\Rules\Interfaces\ModifyValue` and create method `modifyValue($value)` to your custom rule class.
1097+
To do this, you should implements `IgniteKit\Validation\Rules\Interfaces\ModifyValue` and create method `modifyValue($value)` to your custom rule class.
10981098

10991099
For example:
11001100

11011101
```php
11021102
<?php
11031103

1104-
use DG\Validation\Rule;
1105-
use DG\Validation\Rules\Interfaces\ModifyValue;
1104+
use IgniteKit\Validation\Rule;
1105+
use IgniteKit\Validation\Rules\Interfaces\ModifyValue;
11061106

11071107
class YourCustomRule extends Rule implements ModifyValue
11081108
{
@@ -1123,24 +1123,24 @@ class YourCustomRule extends Rule implements ModifyValue
11231123

11241124
You may want to do some preparation before validation running. For example our `uploaded_file` rule will resolves attribute value that come from `$_FILES` (undesirable) array structure to be well-organized array structure, so we can validate multiple file upload just like validating other data.
11251125

1126-
To do this, you should implements `DG\Validation\Rules\Interfaces\BeforeValidate` and create method `beforeValidate()` to your custom rule class.
1126+
To do this, you should implements `IgniteKit\Validation\Rules\Interfaces\BeforeValidate` and create method `beforeValidate()` to your custom rule class.
11271127

11281128
For example:
11291129

11301130
```php
11311131
<?php
11321132

1133-
use DG\Validation\Rule;
1134-
use DG\Validation\Rules\Interfaces\BeforeValidate;
1133+
use IgniteKit\Validation\Rule;
1134+
use IgniteKit\Validation\Rules\Interfaces\BeforeValidate;
11351135

11361136
class YourCustomRule extends Rule implements BeforeValidate
11371137
{
11381138
...
11391139

11401140
public function beforeValidate()
11411141
{
1142-
$attribute = $this->getAttribute(); // DG\Validation\Attribute instance
1143-
$validation = $this->validation; // DG\Validation\Validation instance
1142+
$attribute = $this->getAttribute(); // IgniteKit\Validation\Attribute instance
1143+
$validation = $this->validation; // IgniteKit\Validation\Validation instance
11441144

11451145
// Do something with $attribute and $validation
11461146
// For example change attribute value

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "gdarko/wp-validation",
3-
"description": "PHP Laravel like standalone validation library",
2+
"name": "IgniteKit/validation",
3+
"description": "Laravel inspired validation package for PHP",
44
"license": "MIT",
55
"authors": [
66
{
@@ -10,12 +10,12 @@
1010
],
1111
"autoload": {
1212
"psr-4": {
13-
"DG\\Validation\\": "src"
13+
"IgniteKit\\Validation\\": "src"
1414
}
1515
},
1616
"autoload-dev": {
1717
"psr-4": {
18-
"DG\\Validation\\Tests\\": ["tests", "tests/Fixtures"]
18+
"IgniteKit\\Validation\\Tests\\": ["tests", "tests/Fixtures"]
1919
}
2020
},
2121
"require": {

src/Attribute.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DG\Validation;
3+
namespace IgniteKit\Validation;
44

55
class Attribute
66
{
@@ -14,13 +14,13 @@ class Attribute
1414
/** @var string|null */
1515
protected $alias;
1616

17-
/** @var DG\Validation\Validation */
17+
/** @var Validation */
1818
protected $validation;
1919

2020
/** @var bool */
2121
protected $required = false;
2222

23-
/** @var DG\Validation\Validation|null */
23+
/** @var Attribute|null */
2424
protected $primaryAttribute = null;
2525

2626
/** @var array */
@@ -32,11 +32,10 @@ class Attribute
3232
/**
3333
* Constructor
3434
*
35-
* @param DG\Validation\Validation $validation
36-
* @param string $key
35+
* @param Validation $validation
36+
* @param string $key
3737
* @param string|null $alias
38-
* @param array $rules
39-
* @return void
38+
* @param array $rules
4039
*/
4140
public function __construct(
4241
Validation $validation,
@@ -55,7 +54,8 @@ public function __construct(
5554
/**
5655
* Set the primary attribute
5756
*
58-
* @param DG\Validation\Attribute $primaryAttribute
57+
* @param Attribute $primaryAttribute
58+
*
5959
* @return void
6060
*/
6161
public function setPrimaryAttribute(Attribute $primaryAttribute)
@@ -77,7 +77,7 @@ public function setKeyIndexes(array $keyIndexes)
7777
/**
7878
* Get primary attributes
7979
*
80-
* @return DG\Validation\Attribute|null
80+
* @return Attribute
8181
*/
8282
public function getPrimaryAttribute()
8383
{
@@ -101,7 +101,8 @@ public function setOtherAttributes(array $otherAttributes)
101101
/**
102102
* Add other attributes
103103
*
104-
* @param DG\Validation\Attribute $otherAttribute
104+
* @param Attribute $otherAttribute
105+
*
105106
* @return void
106107
*/
107108
public function addOtherAttribute(Attribute $otherAttribute)
@@ -122,7 +123,8 @@ public function getOtherAttributes(): array
122123
/**
123124
* Add rule
124125
*
125-
* @param DG\Validation\Rule $rule
126+
* @param Rule $rule
127+
*
126128
* @return void
127129
*/
128130
public function addRule(Rule $rule)

src/ErrorBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DG\Validation;
3+
namespace IgniteKit\Validation;
44

55
class ErrorBag
66
{

src/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DG\Validation;
3+
namespace IgniteKit\Validation;
44

55
class Helper
66
{

src/MimeTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DG\Validation;
3+
namespace IgniteKit\Validation;
44

55
class MimeTypeGuesser
66
{

src/MissingRequiredParameterException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DG\Validation;
3+
namespace IgniteKit\Validation;
44

55
class MissingRequiredParameterException extends \Exception
66
{

src/Rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DG\Validation;
3+
namespace IgniteKit\Validation;
44

55
abstract class Rule
66
{

src/RuleNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DG\Validation;
3+
namespace IgniteKit\Validation;
44

55
use Exception;
66

src/RuleQuashException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DG\Validation;
3+
namespace IgniteKit\Validation;
44

55
class RuleQuashException extends \Exception
66
{

0 commit comments

Comments
 (0)