PHP code example of khandurdyiev / monobank-php-client

1. Go to this page and download the library: Download khandurdyiev/monobank-php-client 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/ */

    

khandurdyiev / monobank-php-client example snippets




use Khandurdyiev\MonoClient\MonoClient;

// create a monobank client instance
$mono = new MonoClient();
$currencies = $mono->currency()->all();

foreach ($currencies as $currency) {
    $currencyA = $currency->getCurrencyA(); // USD
    $currencyB = $currency->getCurrencyB(); // UAH
    $date = $currency->getDate(); // returns Carbon instance with date
    // ...
}



use Carbon\Carbon;
use Khandurdyiev\MonoClient\MonoClient;

// create a monobank client instance
$mono = new MonoClient('your_monobank_api_token'); // you can get from https://api.monobank.ua

// Get client info
$clientInfo = $mono->clientInfo();
$name = $clientInfo->getName();
$accounts = $clientInfo->getAccounts()->all();

foreach ($accounts as $account) {
    $balance = $account->getBalance(); // 123456
    $creditLimit = $account->getCreditLimit(); // 654321
    $currency = $account->getCurrency(); // UAH
    
    // ...
}

// Get statements of concrete account
$from = Carbon::now()->subMonth();
$to = Carbon::now();
$statements = $mono->statements($from, $to, 'account_id')->all();

foreach ($statements as $statement) {
    $amount = $statement->getAmount(); // 123456
    $cashbackAmount = $statement->getCashbackAmount(); // 123456
    $currency = $statement->getCurrency(); // UAH
    // ...
}
bash
$ composer