2017 © Pedro Peláez
 

library star-replay

A StarCraft II replay parser in PHP

image

rogiel/star-replay

A StarCraft II replay parser in PHP

  • Friday, August 19, 2016
  • by Rogiel
  • Repository
  • 1 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Star Replay

This library allows you to read StarCraft II replay files from PHP., (*1)

A object-oriented API is provided to browse through all metadata and events available on replays., (*2)

Features

  • Read .SC2Replay files from all public game versions (data is mined from s2protocol)
  • Game events: Streams events using PHP 5 generators
  • Lazy parsing: Parses only structures you require

Installation

The recommended way of installing this library is using Composer., (*3)

composer require "rogiel/star-replay"

This library uses php-mpq to parse and extract compressed information inside replays., (*4)

Example

use Rogiel\StarReplay\Replay;
use Rogiel\StarReplay\Event\Game\CameraSaveEvent;

$replay = new Replay('test.SC2Replay');

echo "Version: " . $replay->getHeader()->getVersion() . "\n";
echo "Map: " . $replay->getMatchInformation()->getTitle() . "\n";
echo "Players:\n";
foreach($replay->getPlayers() as $id => $player) {
    echo "\tPlayer ".$id.": ".$player->getName()."\n";
}

echo "Camera hotkeys:\n";
foreach($replay->getGameEvents() as $timestamp => $event) {
    if($event instanceof CameraSaveEvent) {
        $player = $replay->getPlayers()->getPlayer($event->getHeader()->getUserID());
        echo "\tPlayer ". $player->getName() ." saved a new camera #". $event->getWhich() ." at point ". $event->getTarget() ."\n";
    }
    // since we are using generators, the events will stream linearly from begining to end
}

The Versions

19/08 2016

dev-master

9999999-dev https://rogiel.com/portfolio/star-replay

A StarCraft II replay parser in PHP

  Sources   Download

BSD-2.0

The Requires

 

The Development Requires

blizzard gaming starcraft ii replay parsing

19/08 2016

0.1.5

0.1.5.0 https://rogiel.com/portfolio/star-replay

A StarCraft II replay parser in PHP

  Sources   Download

BSD-2.0

The Requires

 

The Development Requires

blizzard gaming starcraft ii replay parsing

06/08 2016

0.1.4

0.1.4.0 https://rogiel.com/portfolio/star-replay

A StarCraft II replay parser in PHP

  Sources   Download

BSD-2.0

The Requires

 

The Development Requires

blizzard gaming starcraft ii replay parsing

25/07 2016

0.1.3

0.1.3.0 https://rogiel.com/portfolio/star-replay

A StarCraft II replay parser in PHP

  Sources   Download

BSD-2.0

The Requires

 

The Development Requires

blizzard gaming starcraft ii replay parsing

12/07 2016

0.1.2

0.1.2.0 https://rogiel.com/portfolio/star-replay

A StarCraft II replay parser in PHP

  Sources   Download

BSD-2.0

The Requires

 

The Development Requires

blizzard gaming starcraft ii replay parsing

10/07 2016

0.1.1

0.1.1.0 https://rogiel.com/portfolio/star-replay

A StarCraft II replay parser in PHP

  Sources   Download

BSD-2.0

The Requires

 

The Development Requires

blizzard gaming starcraft ii replay parsing

19/01 2016

0.1.0

0.1.0.0 https://rogiel.com/portfolio/star-replay

A StarCraft II replay parser in PHP

  Sources   Download

BSD-2.0

The Requires

 

The Development Requires

blizzard gaming starcraft ii replay parsing