PHP code example of xpocketmc / bedrockprotocol

1. Go to this page and download the library: Download xpocketmc/bedrockprotocol library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xpocketmc / bedrockprotocol example snippets


foreach(PacketBatch::decodePackets(new BinaryStream($payload), PacketPool::getInstance()) as $packetObject){
    var_dump($packetObject); //tada
}

/** @var Packet[] $packets */
$stream = new BinaryStream();
PacketBatch::encodePackets($stream, $packets);
$batchPayload = $stream->getBuffer();