PHP code example of asignua / filament-iban

1. Go to this page and download the library: Download asignua/filament-iban library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

asignua / filament-iban example snippets


use Asignua\FilamentIban\IbanPlugin;

$panel->plugin(IbanPlugin::make());

use Asignua\FilamentIban\Forms\Components\IbanInput;

IbanInput::make('iban')
    ->countries(['UA', 'PL'])   // optional: accept only these countries (ISO 3166-1 alpha-2)
    ->showBankName();           // optional: bank name under the field once it loses focus

use Asignua\FilamentIban\Rules\Iban;

$request->validate([
    'iban' => [']);

use Asignua\FilamentIban\Support\Iban;

Iban::normalize('ua21 3223 1300 0002 6007 2335 6600 1'); // UA213223130000026007233566001
Iban::format('UA213223130000026007233566001');            // UA21 3223 1300 0002 6007 2335 6600 1
Iban::isValid($iban);                                     // bool
Iban::problem($iban);                                     // null | empty | format | unknown_country | length | structure | checksum ('empty': nothing left after removing separators)
Iban::country($iban);                                     // 'UA'
Iban::bankCode($iban);                                    // the SWIFT bank identifier: '322313' (the MFO) for UA, '10901014' for PL, 'WEST' for GB
Iban::branchCode($iban);                                  // branch identifier where the registry has one ('123456' sort code for GB), else null
Iban::example('PL');                                      // a valid example IBAN

use Asignua\FilamentIban\Infolists\Components\IbanEntry;
use Asignua\FilamentIban\Tables\Columns\IbanColumn;

IbanEntry::make('iban')->showBankName();
IbanColumn::make('iban')->showBankName();

use Asignua\FilamentIban\Support\BankDirectories;

app(BankDirectories::class)->bankName($iban); // 'АТ "Укрексімбанк"', null when unknown

use Asignua\FilamentIban\Contracts\BankDirectory;

class GermanBanks implements BankDirectory
{
    public function bankName(string $iban): ?string
    {
        return ['37040044' => 'Commerzbank'][substr($iban, 4, 8)] ?? null;
    }
}

app(BankDirectories::class)->register('DE', GermanBanks::class); // in a service provider's boot()
bash
php artisan vendor:publish --tag=filament-iban-config