A modern fully strong-typed library for using the Monero daemon rpc and wallet rpc APIs

0.7.3 2024-02-21 12:10 UTC


Latest Stable Version Tests PHPStan codecov PHP Version Require

Monero daemon and wallet RPC client library written in modern PHP.


  • Implements Monero wallet and daemon rpc methods
  • Support authentication for the wallet and daemon rpc servers
  • Fully strongly typed and strict_types enabled
  • Minimal dependencies
  • PSR-18 compatible, so different http client libraries can be used


You can install the package with Composer, at this this time minimum-stability has to be set to dev:

composer require refring/monero-rpc-php

When your project does not have a http client available yet, you should require one as well.

Different http clients can be used:


composer require guzzlehttp/guzzle
Other http clients

symfony http client

composer require symfony/http-client psr/http-client nyholm/psr7


composer require kriswallsmith/buzz nyholm/psr7


composer php-http/curl-client


Creating a client

For the wallet rpc client:

$walletClient = (new \RefRing\MoneroRpcPhp\ClientBuilder(''))

echo $walletClient->getVersion()->version;

Daemon rpc client:

$daemonClient = (new \RefRing\MoneroRpcPhp\ClientBuilder(''))

echo $daemonClient->getVersion()->version;

Using authentication

$daemonClient = (new \RefRing\MoneroRpcPhp\ClientBuilder(''))
    ->withAuthentication('foo', 'bar')

echo $daemonClient->getVersion()->version;

Connecting through a proxy

Configuring a proxy is specific to the http client library.

Below is a Symfony Http Client example for a socks5 proxy:

$httpClient = new Psr18Client(new CurlHttpClient([
    'http_version' => '2.0',
    'proxy' => 'socks5://username:password@',

$daemonClient = (new \RefRing\MoneroRpcPhp\ClientBuilder('http://examplenode/json_rpc'))

Injecting a logger

The client builder also supports injecting a logger and/or a http client:

$httpClient = new \Symfony\Component\HttpClient\Psr18Client();
$logger = new \Psr\Log\NullLogger();

$daemonClient = (new \RefRing\MoneroRpcPhp\ClientBuilder(''))    


Creating a wallet and account

// Try to create a wallet, or open it when it already exists
    $walletClient->createWallet('testwallet', 'English', 'password');
} catch (WalletExistsException $e) {
    $walletClient->openWallet('testwallet', 'password');
} catch(MoneroRpcException $e) {
    echo 'An error occured: '.$e->getMessage();

$baseAddressData = $walletClient->getAddress();
$subAddressData = $walletClient->createAddress();

printf("BaseAddress: %s\nSubAddress: %s\n", $baseAddressData->address, $subAddressData->address);

// Create another account
$newAccountData = $walletClient->createAccount('another account');
$newAccountSubAddress = $walletClient->createAddress($newAccountData->accountIndex);

printf("Account %d\nBaseAddress: %s\nSubAddress: %s", $newAccountData->accountIndex, $newAccountData->address, $newAccountSubAddress->address);


The project has unit tests and integration tests, the unit tests can be run using composer test:unit

To run the integration tests, you'll need docker and docker compose or you could run monerod and monero-wallet-rpc on your own.

If you have the docker stack installed, go to the tests folder and run docker compose up. Note that the daemon will run on port 18081 and monero-wallet-rpc will run on port 18083.

After that, run composer test:integration to run the integration tests.


  • More integration tests
  • Improve documentation and add examples






The MIT License (MIT). Please see License File for more information.


  • monero-rpc-rs - Parts of this project served as inspiration.
  • monero-php - Thanks for providing the php ecosystem with a Monero library during all these years!
  • Monero - Thanks to everybody involved!