Skip to content

Commit

Permalink
UPDATE: README.md, CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelpeter committed Mar 15, 2019
1 parent ce8eabe commit 9036b8a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: php
php:
- 7.1
- 7.2
- 7.3

matrix:
include:
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

All Notable changes for the Laravel 5 IsoCodes Validation will be documented in this file

## 3.0.0
- Fix issue #8: missing function replaceVat
- Laravel 5.8
- Upgrade to phpunit 7.5.x
- Add php 7.3 to travis-ci
- Add support for arrays with dot notations to all validation methods
```php
$payload = [
'data' => [
[
'country' => 'DE',
'zipcode' => 63741
],
[
'country' => 'AT',
'zipcode' => 1180
]
]
];

$validator = Validator::make($payload, [
'data.*.zipcode' => 'zipcode:data.*.country'
]);
```
- Refactor: fix scrutinizer issues
- Refactor: add (external) fixtures to tests to reduce number of lines
- Refactor: remove unused function params

## 2.0.0
- Laravel 5.5 compatibility with Auto-Discovery
- Require php 7.0+
Expand Down
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ A simple Laravel 5 wrapper for the [IsoCodes Validation library](https://github.
composer require pixelpeter/laravel5-isocodes-validation
```

### Step 2: Add the Service Provider (not needed with v2.x because of auto discovery)
### Step 2: Add the Service Provider
*(not needed starting with v2.x because of auto discovery)*

Add the service provider in `app/config/app.php`
```php
'provider' => [
Expand All @@ -44,7 +46,7 @@ $rules = [
$validator = Validator::make($payload, $rules);
```

### Examples with parameter
### Examples with reference parameter
Some rules need a reference to be validated against (e.g. `country` for `zipcode`).

Just pass the name of the field holding the reference to the rule.
Expand Down Expand Up @@ -73,6 +75,30 @@ $rules = [
$validator = Validator::make($payload, $rules);
```

### Example with arrays and dot notation
*(added in v3.x)*

As suggested by @otr-tomek I've added support for all validation methods using arrays in dot notation as an input.

```php
$payload = [
'data' => [
[
'country' => 'DE',
'zipcode' => 63741
],
[
'country' => 'AT',
'zipcode' => 1180
]
]
];

$validator = Validator::make($payload, [
'data.*.zipcode' => 'zipcode:data.*.country'
]);
```

### Validation error messages
Error messages can contain the name and value of the field and the value of the reference
```php
Expand Down

0 comments on commit 9036b8a

Please sign in to comment.