Semux PHP SDK aims to provide necessary utilities for web developers to create 3rd party web services connecting to Semux Wallet. Currently the only supported feature is an API client.
PHP 5.6 and later
To install the SDK via Composer, run:
composer require semuxproject/semux-php
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure base URL and HTTP basic authorization of Semux API Server
$config = new Semux\Client\Configuration();
$config->setHost("http://localhost:5171/v2.0.0")
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
$semuxApi = new Semux\Client\Api\SemuxApi(
new GuzzleHttp\Client(),
$config
);
try {
$result = $semuxApi->getInfo();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling SemuxApi->getInfo(): ', $e->getMessage(), PHP_EOL;
}
https://semuxproject.github.io/semux-php/Semux/Client/Api/SemuxApi.html
To run the unit tests:
docker-compose -f .travis/docker/docker-compose.yml up -d && .travis/wait-for-it.sh -h 0.0.0.0 -p 5171 -t 30 -s && sleep 15
composer install
cp phpunit.xml.dist phpunit.xml
./vendor/bin/phpunit