PHP code example of indy2kro / buxfer-api

1. Go to this page and download the library: Download indy2kro/buxfer-api 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/ */

    

indy2kro / buxfer-api example snippets


protected $_config = array(
    'user_agent' => 'PHP BuxferApi ' . self::VERSION,
    'timeout' => 10,
    'handler' => null,
);


$config = array(
    'buxfer_username' => '[email protected]',
    'buxfer_password' => 'testpassword',
    'buxfer_accountId' => '1000000',
);
$buxferApi = new \BuxferApi\Client($buxferConfig);
$buxferApi->login($config['buxfer_username'], $config['buxfer_password']);

// list existing transactions
$transactions = $buxferApi->listTransactions($config['buxfer_accountId']);

// add new transaction
$newTransaction = array(
    'accountId' => $config['buxfer_accountId'],
    'date'  => '2020-02-11 10:20:00',
    'type'  => 'expense',
    'amount' => '10.20',
    'description' => 'Test transaction',
    'tags' => 'mytag1,mytag2'
);
$buxferApi->addTransaction($transaction);