An SDK that provides multiple ways to interact with the Tradebyte API. For more information, visit TB.IO.
- Memory Efficiency: The SDK is designed to consume minimal memory and can efficiently process large XML files - potentially gigabytes in size - through extensive use of iterators and XML readers.
- Flexible Processing: Depending on your needs, you can process data "on the fly" or opt for a "download and re-open" approach.
- Supported Entities: The SDK supports several entities with multiple endpoints, including: 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 the 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