kinimodmeyer / tradebyte-sdk
Tradebyte SDK
Installs: 3 524
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 5
Forks: 6
Open Issues: 0
Requires
- php: 7.4.* || 8.0.* || 8.1.* || 8.2.* || 8.3.*
- ext-curl: *
- ext-simplexml: *
- ext-xmlreader: *
- ext-xmlwriter: *
Requires (Dev)
README
SDK to handle all different ways to interact with Tradebyte API. more informations you will find on TB.IO.
Features
- 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
Requirements
- credentials (username,password,account-number)
- PHP >= 7.4
- Composer
- cURL
Install
- download composer (https://getcomposer.org/download)
- execute the following:
$ composer require kinimodmeyer/tradebyte-sdk
Quick Example (message)
//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 ...
Example Files
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
Tests
execute the test with the following:
$ ./vendor/bin/phpunit tests
Code Analysis
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