{"id":15019035,"url":"https://github.com/denpamusic/php-levin","last_synced_at":"2025-10-24T01:31:15.865Z","repository":{"id":34153869,"uuid":"170244751","full_name":"denpamusic/php-levin","owner":"denpamusic","description":"Pure PHP implementation of monero's levin protocol.","archived":false,"fork":false,"pushed_at":"2022-06-06T01:50:00.000Z","size":246,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T22:32:01.686Z","etag":null,"topics":["aeon","cryptocurrency","cryptonote","monero","p2p","php71","pure-php","safex","xmr"],"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/denpamusic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-12T03:25:03.000Z","updated_at":"2024-05-31T07:30:20.000Z","dependencies_parsed_at":"2022-07-24T20:32:27.846Z","dependency_job_id":null,"html_url":"https://github.com/denpamusic/php-levin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpamusic%2Fphp-levin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpamusic%2Fphp-levin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpamusic%2Fphp-levin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpamusic%2Fphp-levin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denpamusic","download_url":"https://codeload.github.com/denpamusic/php-levin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237901382,"owners_count":19384384,"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":["aeon","cryptocurrency","cryptonote","monero","p2p","php71","pure-php","safex","xmr"],"created_at":"2024-09-24T19:52:48.645Z","updated_at":"2025-10-24T01:31:13.753Z","avatar_url":"https://github.com/denpamusic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pure PHP implementation of Levin protocol\n[![Latest Stable Version](https://poser.pugx.org/denpa/php-levin/v/stable)](https://packagist.org/packages/denpa/php-levin)\n[![License](https://poser.pugx.org/denpa/php-levin/license)](https://packagist.org/packages/denpa/php-levin)\n[![ci](https://github.com/denpamusic/php-levin/actions/workflows/ci.yml/badge.svg)](https://github.com/denpamusic/php-levin/actions/workflows/ci.yml)\n[![Code Climate](https://codeclimate.com/github/denpamusic/php-levin/badges/gpa.svg)](https://codeclimate.com/github/denpamusic/php-levin)\n[![Code Coverage](https://codeclimate.com/github/denpamusic/php-levin/badges/coverage.svg)](https://codeclimate.com/github/denpamusic/php-levin/coverage)\n\n\n## Example\n```php\nrequire 'vendor/autoload.php';\n\nuse Denpa\\Levin;\n\n$vars = [\n    'network_id' =\u003e 'somenetwork',\n];\n\nLevin\\connection($ip, $port, $vars)-\u003econnect(\n    function ($bucket, $connection) {\n        if ($bucket-\u003eisRequest('supportflags', 'timedsync', 'ping')) {\n            // respond to supportflags, timedsync and ping requests\n            // to keep the connection open\n            $connection-\u003ewrite($bucket-\u003eresponse());\n        }\n\n        if ($bucket-\u003eisResponse('handshake')) {\n            // send ping request to the server after\n            // receiving handshake response\n            $connection-\u003ewrite(Levin\\request('ping'));\n        }\n\n        if ($bucket-\u003eisResponse('ping')) {\n            // dump server response to the console\n            var_dump($bucket-\u003egetPayload());\n\n            // returning false closes connection\n            return false;\n        }\n    }\n);\n```\n\n## Request Support\n| command      | link                                                                                                              | request | response  |\n|--------------|-------------------------------------------------------------------------------------------------------------------|---------|-----------|\n| Handshake    | [p2p_protocol_defs.h#L177](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L177) | ✅       | ✅        |\n| TimedSync    | [p2p_protocol_defs.h#L239](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L239) | ✅       | ✅        |\n| Ping         | [p2p_protocol_defs.h#L297](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L297) | ✅       | ✅        |\n| StatInfo     | [p2p_protocol_defs.h#L348](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L348) | ❌       | ❌        |\n| NetworkState | [p2p_protocol_defs.h#L382](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L382) | ❌       | ❌        |\n| PeerId       | [p2p_protocol_defs.h#L414](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L414) | ✅       | ✅        |\n| SupportFlags | [p2p_protocol_defs.h#L437](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L437) | ✅       | ✅        |\n\n\n## Notification Support\n| command                | link                                                                                                                                            | request |\n|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|---------|\n| NewBlock               | [cryptonote_protocol_defs.h#L126](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L126) | ✅       |\n| RequestGetObjects      | [cryptonote_protocol_defs.h#L163](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L163) | ❌       |\n| ResponseGetObjects     | [cryptonote_protocol_defs.h#L179](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L179) | ❌       |\n| RequestChain           | [cryptonote_protocol_defs.h#L217](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L217) | ✅       |\n| ResponseChainEntry     | [cryptonote_protocol_defs.h#L231](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L231) | ✅       |\n| NewFluffyBlock         | [cryptonote_protocol_defs.h#L254](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L254) | ✅       |\n| RequestFluffyMissingTx | [cryptonote_protocol_defs.h#L273](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L273) | ❌       |\n\n## Exceptions\n* `Denpa\\Levin\\Exceptions\\ConnectionException` - thrown on connection errors.\n* `Denpa\\Levin\\Exceptions\\EntryTooLargeException` - thrown when type or packet size is too large.\n* `Denpa\\Levin\\Exceptions\\SignatureMismatchException` - thrown on section or bucket signature mismatches.\n* `Denpa\\Levin\\Exceptions\\UnexpectedTypeException` - thrown on unexpected or invalid type.\n* `Denpa\\Levin\\Exceptions\\UnknownCommandException` - thrown on unknown command.\n* `Denpa\\Levin\\Exceptions\\UnpackException` - thrown when unable to unpack binary data.\n\n## License\nThis product is distributed under the [MIT license](https://github.com/denpamusic/php-levin/blob/master/LICENSE).\n\n## Credits\nLoosely based on [py-levin](https://github.com/xmrdsc/py-levin).\n\n## Donations\nIf you like this project, you can donate using one of the following addresses:\n\nBTC:  \n`3L6dqSBNgdpZan78KJtzoXEk9DN3sgEQJu`  \nMonero:  \n`458j3EKczYFEE1Gku9ENUgTj4KUtHbqP9hT82vFRdZHiBRfbVFDUE7QArtAB63cNZiKMgBgwrD4k1Wtac8ZgoKx2GUHFpo2`  \nSafex:  \n`Safex61BqfGVucrCo71xPxhQi4L1oMaRYUHwBKMuHVy8UTR1HkBjhJx4WafkLvhSwUeshkonyDjvYFiBrRDeEcrL5k6JLALD85L2T`  \n\n❤Thanks for your support!❤\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenpamusic%2Fphp-levin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenpamusic%2Fphp-levin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenpamusic%2Fphp-levin/lists"}