Download the PHP package arnezt/binancephpsdk without Composer
On this page you can find all versions of the php package arnezt/binancephpsdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arnezt/binancephpsdk
More information about arnezt/binancephpsdk
Files in arnezt/binancephpsdk
Package binancephpsdk
Short Description This repository contains the PHP-SDK to interact with Binance DEX. It's supported by mostly pure PHP code.
License MIT
Homepage http://arnezt.github.io/binancephpsdk
Informations about the package binancephpsdk
binance-php-sdk
(Fork from hammadtq/binance-php-sdk
Porting to composer)
This repository contains the PHP-SDK to interact with Binance DEX. It's supported by mostly pure PHP code. The documentation for Binance DEX supported methods is here.
Installation
At the moment, you will have to clone the repo and include it in your project. In the future, it will be available through composer. (Added: Available via composer):
composer require arnezt/binancephpsdk
The SDK relies on secp256k1-php. There is currently no easy method to install secp256k1-php extension, you will need compile it yourself.
To Install:
(First check (Ubuntu/Debian) if phpize
has available: sudo apt install php7.x-dev
)
libsecp256k1:
git clone [email protected]:bitcoin-core/secp256k1 && \
cd secp256k1 && \
./autogen.sh && \
./configure --enable-experimental --enable-module-{ecdh,recovery} && \
make && \
sudo make install && \
cd ../
secp256k1-php:
git clone [email protected]:Bit-Wasp/secp256k1-php && \
cd secp256k1-php/secp256k1 && \
phpize && \
./configure --with-secp256k1 && \
make && sudo make install && \
cd ../../
(Optional) - Enable extension by default!
If you're a heavy user, you can add this line to your php.ini files for php-cli, apache2, or php-fpm.
extension=secp256k1.so
(Added: Check php conf (php7.x-fpm if using fpm) change x with your php version):
$ sudo nano /etc/php/7.x/mods-available/secp256k1.ini
add: extension=secp256k1.so
$ sudo ln -s /etc/php/7.x/mods-available/secp256k1.ini /etc/php/7.x/fpm/conf.d/20-secp256k1.ini
(for fpm)
$ sudo ln -s /etc/php/7.x/mods-available/secp256k1.ini /etc/php/7.x/cli/conf.d/20-secp256k1.ini
(for cli)
The repository was made on Mac OSX using PHP version 7.15.3
. You will also need a version above 7. It is advised to go with native PHP installation instead of going with XAMPP or WAMPP so to take advantage of secp256k1-php natively. Also, you may need gmp
extension.
To handle big numbers, the SDK makes use of brick/math precision library. Please consider using this or another bcmath
or gmp
based solutions while dealing with blockchain based numbers.
Examples
Note: Please see Issue Tracker to understand what methods are currently available in the sdk.
You can find full example scripts in the src folder.
Few examples to interact with SDK are below:
Keystore reload and getting private key
Similary, if you want to see the hex of private key, simply use this method:
$keystore->getPrivateKey()->getHex();
A typical transfer request will look something like this:
Placing an order
Amino Encoding
The SDK uses Google proto3 generator to support Binance's aminor encoding/decoding. If you ever include new messages to the proto file, run following command to run the generator from the root:
protoc --proto_path=proto --php_out=./gen proto/dex.proto
Key Generation
Key generation is supported via secp256k1-php library as well.
Once you generate an address, make sure to send an amount on it as the Binance DEX will not make an account unless a transaction is received on an address.
Supported Methods
- Keypair generation
- Keypair generation with mnemonic
- Keystore reload
- Fetching JSON-RPC functions
- Fetch API functions
- Transactions: Transfer, NewOrder, CancelOrder, TokenFreeze, TokenUnFreeze, Issue, Mint, Burn, HTLT, DepositHTLT, ClaimHTLT, RefundHTLT, TimeLock, TimeRelock, TimeUnlock
Many thanks to https://github.com/hammadtq/binance-php-sdk has provided the original source code.
All versions of binancephpsdk with dependencies
graze/guzzle-jsonrpc Version ^3.2
bitwasp/buffertools Version ^0.5.7
google/protobuf Version ^3.11
brick/math Version ^0.8.14
bitwasp/bitcoin Version ^1.0
ramsey/uuid Version ^4.0
php Version >=7.0