PHP code example of allejo / bzflag-networking.php
1. Go to this page and download the library: Download allejo/bzflag-networking.php 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/ */
allejo / bzflag-networking.php example snippets
use allejo\bzflag\replays\Replay;
$replay = new Replay(__DIR__ . '/my-bz-replay.rec');
foreach ($replay->getPacketsIterable() as $packet) {
// do something with $packet
}
use allejo\bzflag\networking\Packets\GamePacket;
/** @var GamePacket[] $packets */
$packets = $replay->getPacketsAsArray();
use allejo\bzflag\replays\Replay;
use allejo\bzflag\world\WorldDatabase;
$replay = new Replay(__DIR__ . '/my-bz-replay.rec');
/** @var WorldDatabase $worldDB */
$worldDB = $replay->getHeader()->getWorldDatabase();
// or an convenience method exists too
$worldDB = $replay->getWorldDatabase();
use allejo\bzflag\replays\Replay;
$replay = new Replay(__DIR__ . '/my-bz-replay.rec');
$json = json_encode($replay, JSON_PRETTY_PRINT);
file_put_contents(__DIR__ . '/my-bz-replay.rec.json', $json);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.