Skip to content

This package is designed to obtain information from the demo of the servers or games on the Half-Life 1 engine

License

Notifications You must be signed in to change notification settings

VitalyArt/hltv-demo-parser

Repository files navigation

HLTV Demo Parser

Packagist PHP Version Packagist Version GitHub repo size GitHub Workflow Status

This package is designed to obtain information from the demo of the servers or games on the Half-Life 1 engine. Installation is possible in two versions:

  1. Install with composer, either run
$ php composer.phar require vitalyart/hltv-demo-parser "*"

or add

"vitalyart/hltv-demo-parser": "*"

to the require section of your composer.json file.

$parser = new \VitalyArt\DemoParser\Parser();
$parser->setDemoFile('/path/to/demo/pub-1609152130-de_dust2_2x2.dem');

$demo = $parser->getDemo();

$demo->getDemoProtocol();
$demo->getNetProtocol();
$demo->getMapName();
$demo->getClientName();
$demo->getStartTime();
$demo->getEndTime();
$demo->getDuration();

foreach($demo->getEntries() as $entry) {
    $entry->getTypeString();
    $entry->getType();
    $entry->getDescription();
    $entry->getFlags();
    $entry->getCDTrack();
    $entry->getTrackTime();
    $entry->getFrames();
    $entry->getOffset();
    $entry->getFileLength();
}