baraveli / bml-transaction
PHP Package for getting transactions from BML.
Requires
- guzzlehttp/guzzle: ^7.0.1
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.2
- vlucas/phpdotenv: ^5.2
This package is auto-updated.
Last update: 2023-01-18 01:41:25 UTC
README
Note: This package is not maintained anymore after the bml api update
PHP Package for getting transactions from BML. (Experimental) This package wraps around the official BML Web API.
Installation
composer require baraveli/bml-transaction
Usage
Login
This method will try to authenticate with the BML API. First argument is your bml username and second is bml password. When you login there will be two available properties authenticationStatus
and userID
.
use Baraveli\BMLTransaction\BML; $bml = new BML; $bml->login("username", "password");
Get Transactions Made Today : array
use Baraveli\BMLTransaction\BML; $bml = new BML; $bml->login("username", "password") ->GetTodayTransactions();
Get the Pending Transactions : array
use Baraveli\BMLTransaction\BML; $bml = new BML; $bml->login("username", "password") ->GetPendingTransactions();
Get transactions made between a date range.
Dates passed to the argument of the function goes through php strtotime()
function. Which can parse about any English textual datetime description into a Unix timestamp. You can pass the arguments in any type of format you want. Transactions are paginated by the BML API. If you wish to get the next page of what you requested you may pass a third argument to the function which will correspond to page number.
use Baraveli\BMLTransaction\BML; $bml = new BML; $bml->login("username", "password") ->GetTransactionsBetween("December 15 2019", "August 1 2020");
This will return all the transactions made in December 15 2019 to August 1 2020. You can only get the transactions made with in 12 months.
Multi Account Support
Get all the accounts attached to the bml user.
use Baraveli\BMLTransaction\BML; $bml = new BML; $bml->login("username", "password") ->GetAccounts();
Get the transactions made today from a specified account
use Baraveli\BMLTransaction\BML; $bml = new BML; // Get todays transaction from first account $bml->login("username", "password", 0) ->GetTodayTransactions(); // Get todays transaction from second account $bml->login("username", "password", 1) ->GetTodayTransactions();
Running the tests
Create .env.testing in root directory of the cloned repo. Fill the credentials
BML_USERNAME=
BML_PASSWORD=
To run the tests run
vendor/bin/phpunit