Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hungarian adapter to README #10

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Via composer: `composer require rikudou/iban`

## Usage

There are two validators and two iban implementations, one generic and one for
Czech accounts.
There are multiple IBAN implementations:

### Generic IBAN

Expand All @@ -39,8 +38,8 @@ $iban = new IBAN('CZ5530300000001325090010');

$validator = $iban->getValidator(); // returns instance of GenericIbanValidator

if(!$validator->isValid()) {
// do something on invalid iban
if (!$validator->isValid()) {
// do something
}
```

Expand Down Expand Up @@ -72,7 +71,37 @@ $iban = new CzechIbanAdapter('1325090010', '3030');
// CzechIbanValidator and GenericIbanValidator
$validator = $iban->getValidator();

if(!$validator->isValid()) {
if (!$validator->isValid()) {
// do something
}
```

### Hungarian IBAN

```php
<?php

use Rikudou\Iban\Iban\HungarianIbanAdapter;

$iban = new HungarianIbanAdapter('11773016-11111018');

echo $iban->asString(); // prints HU42117730161111101800000000
```

### Hungarian IBAN validator

```php
<?php

use Rikudou\Iban\Iban\HungarianIbanAdapter;

$iban = new HungarianIbanAdapter('11773016-11111018');

// returns an instance of CompoundValidator which contains
// HungarianIbanValidator and GenericIbanValidator
$validator = $iban->getValidator();

if (!$validator->isValid()) {
// do something
}
```