{"id":15146780,"url":"https://github.com/refring/monero-rpc-php","last_synced_at":"2025-03-30T11:31:38.098Z","repository":{"id":193956189,"uuid":"673085373","full_name":"refring/monero-rpc-php","owner":"refring","description":"Monero daemon and wallet RPC client library written in modern PHP.","archived":false,"fork":false,"pushed_at":"2025-02-12T15:14:56.000Z","size":598,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T04:41:31.475Z","etag":null,"topics":["monero","monero-daemon","monero-rpc","monero-wallet","php8"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/refring.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-31T20:52:28.000Z","updated_at":"2025-02-12T15:14:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"bcf57ae4-b166-47bc-a2f1-fe486258d327","html_url":"https://github.com/refring/monero-rpc-php","commit_stats":{"total_commits":199,"total_committers":3,"mean_commits":66.33333333333333,"dds":"0.11055276381909551","last_synced_commit":"0b44bc199fd25302f5659a095fb9502ab5c811f3"},"previous_names":["refactor-ring/monero-rpc-php","refring/monero-rpc-php"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refring%2Fmonero-rpc-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refring%2Fmonero-rpc-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refring%2Fmonero-rpc-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refring%2Fmonero-rpc-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/refring","download_url":"https://codeload.github.com/refring/monero-rpc-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314011,"owners_count":20757450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["monero","monero-daemon","monero-rpc","monero-wallet","php8"],"created_at":"2024-09-26T12:04:53.409Z","updated_at":"2025-03-30T11:31:38.092Z","avatar_url":"https://github.com/refring.png","language":"PHP","funding_links":[],"categories":["Libraries"],"sub_categories":["Other Wallets"],"readme":"# Monero Daemon \u0026 Wallet RPC client\n[![Packagist Version](https://img.shields.io/packagist/v/refring/monero-rpc-php)](https://packagist.org/packages/refring/monero-rpc-php)\n[![Tests](https://github.com/refactor-ring/monero-rpc-php/actions/workflows/tests.yml/badge.svg)](https://github.com/refactor-ring/monero-rpc-php/actions/workflows/tests.yml)\n[![PHPStan](https://github.com/refactor-ring/monero-rpc-php/actions/workflows/phpstan.yml/badge.svg)](https://github.com/refactor-ring/monero-rpc-php/actions/workflows/phpstan.yml)\n[![codecov](https://codecov.io/gh/refactor-ring/monero-rpc-php/graph/badge.svg?token=P8K26M8W6N)](https://codecov.io/gh/refactor-ring/monero-rpc-php)\n[![Packagist Dependency Version](https://img.shields.io/packagist/dependency-v/refring/monero-rpc-php/php)](https://packagist.org/packages/refring/monero-rpc-php)\n\n\nMonero daemon and wallet RPC client library written in modern PHP.\n\n## Features\n* Implements Monero wallet and daemon rpc methods\n* Support authentication for the wallet and daemon rpc servers\n* Fully strongly typed and strict_types enabled\n* Minimal dependencies\n* PSR-18 compatible, so different http client libraries can be used\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n## Installation\n\nYou can install the package with Composer, at this this time minimum-stability has to be set to dev:\n```bash\ncomposer require refring/monero-rpc-php\n```\n\nWhen your project does not have a http client available yet, you should require one as well.\n\nDifferent http clients can be used:\n\n### guzzle\n```bash \ncomposer require guzzlehttp/guzzle\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eOther http clients\u003c/summary\u003e\n\n### symfony http client\n```bash\ncomposer require symfony/http-client psr/http-client nyholm/psr7\n```\n\n### buzz\n```bash\ncomposer require kriswallsmith/buzz nyholm/psr7\n```\n\n### php-http/curl-client\n```bash\ncomposer php-http/curl-client\n```\n\u003c/details\u003e\n\n## Setup\n\n### Creating a client\nFor the wallet rpc client:\n\n```php\n$walletClient = (new \\RefRing\\MoneroRpcPhp\\ClientBuilder('http://127.0.0.1:18081/json_rpc'))\n    -\u003ebuildWalletClient();\n\necho $walletClient-\u003egetVersion()-\u003eversion;\n```\nDaemon rpc client:\n\n```php\n$daemonClient = (new \\RefRing\\MoneroRpcPhp\\ClientBuilder('http://127.0.0.1:18081/json_rpc'))\n    -\u003ebuildDaemonClient();\n\necho $daemonClient-\u003egetVersion()-\u003eversion;\n```\n\n### Using authentication\n\n```php\n$daemonClient = (new \\RefRing\\MoneroRpcPhp\\ClientBuilder('http://127.0.0.1:18081/json_rpc'))\n    -\u003ewithAuthentication('foo', 'bar')\n    -\u003ebuildDaemonClient();\n\necho $daemonClient-\u003egetVersion()-\u003eversion;\n```\n\n### Connecting through a proxy\nConfiguring a proxy is specific to the http client library.\n\nBelow is a Symfony Http Client example for a socks5 proxy:\n```php\n$httpClient = new Psr18Client(new CurlHttpClient([\n    'http_version' =\u003e '2.0',\n    'proxy' =\u003e 'socks5://username:password@127.0.0.1:9999',\n]));\n\n$daemonClient = (new \\RefRing\\MoneroRpcPhp\\ClientBuilder('http://examplenode/json_rpc'))\n    -\u003ewithHttpClient($httpClient)\n    -\u003ebuildDaemonClient();\n```\n\n### Injecting a logger\nThe client builder also supports injecting a logger and/or a http client: \n```php\n$httpClient = new \\Symfony\\Component\\HttpClient\\Psr18Client();\n$logger = new \\Psr\\Log\\NullLogger();\n\n$daemonClient = (new \\RefRing\\MoneroRpcPhp\\ClientBuilder('http://127.0.0.1:18081/json_rpc'))    \n    -\u003ewithHttpClient($httpClient)\n    -\u003ewithLogger($logger)\n    -\u003ebuildDaemonClient();\n```\n\n## Usage\n### Creating a wallet and account\n```php\n// Try to create a wallet, or open it when it already exists\ntry{\n    $walletClient-\u003ecreateWallet('testwallet', 'English', 'password');\n} catch (WalletExistsException $e) {\n    $walletClient-\u003eopenWallet('testwallet', 'password');\n} catch(MoneroRpcException $e) {\n    echo 'An error occured: '.$e-\u003egetMessage();\n}\n\n$baseAddressData = $walletClient-\u003egetAddress();\n$subAddressData = $walletClient-\u003ecreateAddress();\n\nprintf(\"BaseAddress: %s\\nSubAddress: %s\\n\", $baseAddressData-\u003eaddress, $subAddressData-\u003eaddress);\n\n// Create another account\n$newAccountData = $walletClient-\u003ecreateAccount('another account');\n$newAccountSubAddress = $walletClient-\u003ecreateAddress($newAccountData-\u003eaccountIndex);\n\nprintf(\"Account %d\\nBaseAddress: %s\\nSubAddress: %s\", $newAccountData-\u003eaccountIndex, $newAccountData-\u003eaddress, $newAccountSubAddress-\u003eaddress);\n\n```\n\n## Testing\n\nThe project has unit tests and integration tests, the unit tests can be run using `composer test:unit`\n\nTo run the integration tests, you'll need `docker` and `docker compose`  or you could run `monerod` and `monero-wallet-rpc` on your own.\n\nIf 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`.\n\nAfter that, run `composer test:integration` to run the integration tests.\n\n## Roadmap\n- [ ] More integration tests\n- [ ] Improve documentation and add examples\n\n##  Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md)\n\n\n##  Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md)\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## Acknowledgments\n* [monero-rpc-rs](https://github.com/monero-rs/monero-rpc-rs) - Parts of this project served as inspiration.\n* [monero-php](https://github.com/monero-integrations/monerophp) - Thanks for providing the php ecosystem with a Monero library during all these years!\n* [Monero](https://getmonero.org) - Thanks to everybody involved!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefring%2Fmonero-rpc-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frefring%2Fmonero-rpc-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefring%2Fmonero-rpc-php/lists"}