PHP code example of higi90 / spayd-parser

1. Go to this page and download the library: Download higi90/spayd-parser 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/ */

    

higi90 / spayd-parser example snippets




igi90\SpaydParser;

$spaydString = 'SPD*1.0*ACC:CZ2806000000000168540115+FIOBCZPP*AM:450.00*CC:CZK*MSG:PLATBA ZA ZBOZI*X-VS:1234567890';
$spayd = new SpaydParser\Spayd($spaydString);

echo 'ACC: ' . $spayd->getParam('ACC') . "\n";
echo 'MSG: ' . $spayd->getParam('MSG') . "\n";

$account = $spayd->getAccount();
echo 'IBAN: ' . $account->getIban() . "\n";
echo 'SWIFT: ' . $account->getSwift() . "\n";

if($account instanceof SpaydParser\AccountCzech) {
    echo 'Account number: ' . $account->getAccountNumber() . "\n";
    echo 'Bank code: ' . $account->getBankCode() . "\n";
}