PHP code example of pocketmine / bedrock-protocol
1. Go to this page and download the library: Download pocketmine/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/ */
pocketmine / 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();