Download the PHP package sonofliberty/php-electron-cash-slp-api without Composer
On this page you can find all versions of the php package sonofliberty/php-electron-cash-slp-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sonofliberty/php-electron-cash-slp-api
More information about sonofliberty/php-electron-cash-slp-api
Files in sonofliberty/php-electron-cash-slp-api
Package php-electron-cash-slp-api
Short Description PHP wrapper for Electron Cash SLP JSONRPC-API
License GPL-3.0-or-later
Informations about the package php-electron-cash-slp-api
php-electrum-api - Electrum library
Please note, this library is by far not completed and but can be used in production. Until now i only implemented the most commonly used API-Calls. If you think im missing something, just create an issue or fork the project.
Setting up Electrum
First you need to setup a new Electrum wallet. Follow the instructions according to your OS at the Electrum Download Page. After the successfull installation you need to set a rpcport by typing:
Then we can create a default wallet, dont forget to note your generated seed, it's nescessary if you want to recover it one day:
Now we can go ahead and start Electrum in daemon mode:
Since some new version electrum wants you to load your wallet by hand on startup:
Requirements
On the PHP side there are not much requirements, you only need at least PHP 5.6 and the curl-Extension installed. Then you can go ahead ans it through Composer which will do everything else for you.
Install
First you need to install Composer, after you accomplished this you can go ahead:
Then you can simply include the autoloader and begin using the library:
Examples
Basic example
A very basic useage example. Every API-Call has it's own request-object. You simply create one and execute it.
Custom Client Configuration
Every Request/Method takes a Electrum\Client
-instance as parameter which replaces the default one. A custom instance can be usefull if you want to set custom config params like another Hostname or Port.
Advanced exception handling
Dealing with exceptions is easy. You can catch two types of exceptions which indicates whether it's an Request or Response fault.