PHP code example of clousclouds / bedrock-protocol

1. Go to this page and download the library: Download clousclouds/bedrock-protocol 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/ */

    

clousclouds / bedrock-protocol 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();