PHP code example of secretdz / php-wallet-lib

1. Go to this page and download the library: Download secretdz/php-wallet-lib 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/ */

    

secretdz / php-wallet-lib example snippets



secretdz\phpwalletlib\PhpWalletLib;

// Log in
$wallet = new PhpWalletLib('[email protected]', 'hunter2', 'email'); // Can also specify mobile instead of email for username and type.

// Dump profile
var_dump($wallet->GetProfile());

// Get current balance
echo 'Balance: ' . $wallet->GetBalance();

// Top up TrueMoney cash card to this account
if ($wallet->TopupCashCard('012345678901234')) {
    echo 'Topup complete!';
} else {
    echo 'Topup failed!';
}

// Get last 30 transaction from yesterday and print all income
// Check Transaction.php and TransactionDetails.php to see what this wrapper covers.
// PhpWalletLib parameter of Transaction::LoadDetails can be omitted after the first call.
// Or you can just store the TransactionDetails returned from it in a variable :)
$start = date('Y-m-d', strtotime('-1 days'));
$end = date('Y-m-d', strtotime('1 days'));
$txs = $wallet->GetPastTransactions($start, $end, 30)->transactions;
foreach ($txs as $tx) {
    if ($tx->GetAction() === 'creditor') {
        $details = $tx->LoadDetails($wallet);
        echo '[' . $tx->GetDateTime()->format('Y-m-d H:i') . '] Transaction from ' . $details->GetSenderName() . ' with amount of ' . $tx->GetAmount() . ' with message "' . $details->GetMessage() . '" <br>';
    }
}


composer