khandurdyiev / monobank-php-client
PHP Client for Monobank API
v1.0.5
2021-04-11 18:02 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- alcohol/iso4217: ^4.0
- guzzlehttp/guzzle: ^7.2
- nesbot/carbon: ^2.44
Requires (Dev)
- phpstan/phpstan: ^0.12
- phpstan/phpstan-strict-rules: ^0.12
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
- vimeo/psalm: ^4.3
README
Monobank php client helps you to use Monobank API easily.
Installation
It's recommended that you use Composer to install Monobank php client.
$ composer require khandurdyiev/monobank-php-client
Important
All money amounts in dime (according to Monobank API)
Basic Usage (Public Data)
<?php 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 // ... }
Usage with token (Private Data)
<?php 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 // ... }
License
The MIT License (MIT). Please see License File for more information.