PHPackages                             denpa/php-levin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. denpa/php-levin

ActiveLibrary[HTTP &amp; Networking](/categories/http)

denpa/php-levin
===============

Pure PHP implementation of monero's Levin protocol.

v1.0.1(7y ago)661MITPHPPHP &gt;=7.1CI failing

Since Feb 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/denpamusic/php-levin)[ Packagist](https://packagist.org/packages/denpa/php-levin)[ Docs](https://github.com/denpamusic/php-levin)[ RSS](/packages/denpa-php-levin/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Pure PHP implementation of Levin protocol
=========================================

[](#pure-php-implementation-of-levin-protocol)

[![Latest Stable Version](https://camo.githubusercontent.com/08d6896ef432d57512d9908067a2af9532b2f220fc5a0e656fb73e24a29d2d87/68747470733a2f2f706f7365722e707567782e6f72672f64656e70612f7068702d6c6576696e2f762f737461626c65)](https://packagist.org/packages/denpa/php-levin)[![License](https://camo.githubusercontent.com/3b183c7f088adabba49c50d27b2ad2fa7c1e3a6451b79451c72b45ba948b02ae/68747470733a2f2f706f7365722e707567782e6f72672f64656e70612f7068702d6c6576696e2f6c6963656e7365)](https://packagist.org/packages/denpa/php-levin)[![ci](https://github.com/denpamusic/php-levin/actions/workflows/ci.yml/badge.svg)](https://github.com/denpamusic/php-levin/actions/workflows/ci.yml)[![Code Climate](https://camo.githubusercontent.com/747a70b5d12cee15c8b56001a3424b1e5178cd60881d1e0ce5857b31427fa131/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f64656e70616d757369632f7068702d6c6576696e2f6261646765732f6770612e737667)](https://codeclimate.com/github/denpamusic/php-levin)[![Code Coverage](https://camo.githubusercontent.com/7c151337df5a05537dc78f9dfaf8bf550dea5875437b3a2aa4cfa12a33dcf593/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f64656e70616d757369632f7068702d6c6576696e2f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/denpamusic/php-levin/coverage)

Example
-------

[](#example)

```
require 'vendor/autoload.php';

use Denpa\Levin;

$vars = [
    'network_id' => 'somenetwork',
];

Levin\connection($ip, $port, $vars)->connect(
    function ($bucket, $connection) {
        if ($bucket->isRequest('supportflags', 'timedsync', 'ping')) {
            // respond to supportflags, timedsync and ping requests
            // to keep the connection open
            $connection->write($bucket->response());
        }

        if ($bucket->isResponse('handshake')) {
            // send ping request to the server after
            // receiving handshake response
            $connection->write(Levin\request('ping'));
        }

        if ($bucket->isResponse('ping')) {
            // dump server response to the console
            var_dump($bucket->getPayload());

            // returning false closes connection
            return false;
        }
    }
);
```

Request Support
---------------

[](#request-support)

commandlinkrequestresponseHandshake[p2p\_protocol\_defs.h#L177](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L177)✅✅TimedSync[p2p\_protocol\_defs.h#L239](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L239)✅✅Ping[p2p\_protocol\_defs.h#L297](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L297)✅✅StatInfo[p2p\_protocol\_defs.h#L348](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L348)❌❌NetworkState[p2p\_protocol\_defs.h#L382](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L382)❌❌PeerId[p2p\_protocol\_defs.h#L414](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L414)✅✅SupportFlags[p2p\_protocol\_defs.h#L437](https://github.com/monero-project/monero/blob/master/src/p2p/p2p_protocol_defs.h#L437)✅✅Notification Support
--------------------

[](#notification-support)

commandlinkrequestNewBlock[cryptonote\_protocol\_defs.h#L126](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L126)✅RequestGetObjects[cryptonote\_protocol\_defs.h#L163](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L163)❌ResponseGetObjects[cryptonote\_protocol\_defs.h#L179](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L179)❌RequestChain[cryptonote\_protocol\_defs.h#L217](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L217)✅ResponseChainEntry[cryptonote\_protocol\_defs.h#L231](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L231)✅NewFluffyBlock[cryptonote\_protocol\_defs.h#L254](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L254)✅RequestFluffyMissingTx[cryptonote\_protocol\_defs.h#L273](https://github.com/monero-project/monero/blob/master/src/cryptonote_protocol/cryptonote_protocol_defs.h#L273)❌Exceptions
----------

[](#exceptions)

- `Denpa\Levin\Exceptions\ConnectionException` - thrown on connection errors.
- `Denpa\Levin\Exceptions\EntryTooLargeException` - thrown when type or packet size is too large.
- `Denpa\Levin\Exceptions\SignatureMismatchException` - thrown on section or bucket signature mismatches.
- `Denpa\Levin\Exceptions\UnexpectedTypeException` - thrown on unexpected or invalid type.
- `Denpa\Levin\Exceptions\UnknownCommandException` - thrown on unknown command.
- `Denpa\Levin\Exceptions\UnpackException` - thrown when unable to unpack binary data.

License
-------

[](#license)

This product is distributed under the [MIT license](https://github.com/denpamusic/php-levin/blob/master/LICENSE).

Credits
-------

[](#credits)

Loosely based on [py-levin](https://github.com/xmrdsc/py-levin).

Donations
---------

[](#donations)

If you like this project, you can donate using one of the following addresses:

BTC:
`3L6dqSBNgdpZan78KJtzoXEk9DN3sgEQJu`
Monero:
`458j3EKczYFEE1Gku9ENUgTj4KUtHbqP9hT82vFRdZHiBRfbVFDUE7QArtAB63cNZiKMgBgwrD4k1Wtac8ZgoKx2GUHFpo2`
Safex:
`Safex61BqfGVucrCo71xPxhQi4L1oMaRYUHwBKMuHVy8UTR1HkBjhJx4WafkLvhSwUeshkonyDjvYFiBrRDeEcrL5k6JLALD85L2T`

❤Thanks for your support!❤

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

2637d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8efe9703edc14d73aee59721f70a934b2d914ba12929c81ed51b54301c863b8?d=identicon)[denpamusic](/maintainers/denpamusic)

---

Top Contributors

[![denpamusic](https://avatars.githubusercontent.com/u/16575433?v=4)](https://github.com/denpamusic "denpamusic (119 commits)")

---

Tags

aeoncryptocurrencycryptonotemonerop2pphp71pure-phpsafexxmrnetworkp2pMonerolevin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/denpa-php-levin/health.svg)

```
[![Health](https://phpackages.com/badges/denpa-php-levin/health.svg)](https://phpackages.com/packages/denpa-php-levin)
```

###  Alternatives

[mikepultz/netdns2

PHP DNS Resolver and Updater Library

1292.1k5](/packages/mikepultz-netdns2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
