sagleft / mfcoin-php
PHP library for MFCoin API
Fund package maintenance!
Tidelift
Requires
- php: ^7.0
- guzzlehttp/guzzle: ^6.0
Requires (Dev)
- phpunit/phpunit: ^7.0 || ^8.0
- vlucas/phpdotenv: ^3.3
This package is auto-updated.
Last update: 2025-03-05 04:29:55 UTC
README
To the horror, a simple library for sending requests to the MFCoin node via JSON RPC in terrible and outdated PHP (you need more jokes about PHP, write me, add to readme)
Have fun
-
How to install
composer require sagleft/mfcoin-php
-
Initialize MFCoin connection/object:
$mfcoin = new MFCoin\Client('username','password');
Optionally, you can specify a host, port. Default is HTTP on localhost port 22824.
$mfcoin = new MFCoin\Client('username','password','localhost','22824');
If you wish to make an SSL connection you can set an optional CA certificate or leave blank
$mfcoin->setSSL('/full/path/to/mycertificate.cert');
-
Make calls to mfcoind as methods for your object. Examples:
$mfcoin->getinfo(); $mfcoin->getrawtransaction('7ce62a44093ee359d86a1707ecf362925afcc918ba38c837dfa42f89572a6816',1); $mfcoin->getblock('fbbb5b7f32e562387dc377c24c99778ced80ca726a3cd4bb3bcb13b652f3f6e1');
-
You can look at other methods in the MFCoin wallet by typing the "help" command or use:
print_r($mfcoin->help());
Additional Info
-
When a call fails for any reason, it will return false and put the error message in
$mfcoin->error
-
The HTTP status code can be found in $mfcoin->status and will either be a valid HTTP status code or will be 0 if cURL was unable to connect.
-
The full response (not usually needed) is stored in
$mfcoin->response
while the raw JSON is stored in$mfcoin->raw_response