SDK to handle all different ways to interact with Tradebyte API. more informations you will find on TB.IO.
- the sdk is build that way that it not consume much memory and can even process gigabyte of data. this is done by heavy use of iterators and xml readers.
- depending on the call you can choose between "on the fly" or "download/re-open" processing.
- the following entities with multiple endpoints are supported: product, order, message, stock, upload
- credentials (username,password,account-number)
- PHP >= 7.4
- Composer
- cURL
- download composer (https://getcomposer.org/download)
- execute the following:
$ composer require kinimodmeyer/tradebyte-sdk
//only needed if not already included
require './vendor/autoload.php';
$client = new Tradebyte\Client([
'credentials' => [
'account_number' => '',
'account_user' => '',
'account_password' => ''
]
]);
//different handler can be used here
$messageHandler = $client->getMessageHandler();
//fetch message with message-identifier 5
var_dump($messageHandler->getMessage(5)->getId());
//or download/reopen message
$messageHandler->downloadMessage(__DIR__.'/message_5.xml', 5);
var_dump($messageHandler->getMessageFromFile(__DIR__.'/message_5.xml'));
//see also the other possible methods on the handler for list-handling, acknowledge an many more ...
copy vendor/kinimodmeyer/tradebyte-sdk/examples/
folder to your project-root.
rename examples/example_credentials.php
to examples/credentials.php
and replace the credentials.
execute the examples from the cli:
$ php examples/products.php channel=1370 id=123
$ php examples/orders.php
$ php examples/messages.php
$ php examples/stock.php channel=1370 delta=123
execute the test with the following:
$ ./vendor/bin/phpunit tests
execute the analysis with the following:
$ ./vendor/bin/phpcs src
$ ./vendor/bin/phpcs tests
fix (if possible) with the following:
$ ./vendor/bin/phpcbf src
$ ./vendor/bin/phpcbf tests