PHPackages                             jibix/replay - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jibix/replay

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jibix/replay
============

13921[1 issues](https://github.com/J1b1x/Replay/issues)PHP

Since Aug 2Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/J1b1x/Replay)[ Packagist](https://packagist.org/packages/jibix/replay)[ RSS](/packages/jibix-replay/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Replay
======

[](#replay)

[![php](https://camo.githubusercontent.com/6e2ca56a2d75d2d6d8bdbcea333f3f9bf4576c0229affc2b32fbc3ce47fe62f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312d696e666f726d6174696f6e616c)](https://camo.githubusercontent.com/6e2ca56a2d75d2d6d8bdbcea333f3f9bf4576c0229affc2b32fbc3ce47fe62f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312d696e666f726d6174696f6e616c)[![api](https://camo.githubusercontent.com/09f5789e63311cafb26c8af7e2f3f9f5fd29d49b678e18edad26402ee7abb73c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706f636b65746d696e652d352e302d696e666f726d6174696f6e616c)](https://camo.githubusercontent.com/09f5789e63311cafb26c8af7e2f3f9f5fd29d49b678e18edad26402ee7abb73c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706f636b65746d696e652d352e302d696e666f726d6174696f6e616c)

A PocketMine-MP library to record and replay games. You can find an example of how to use this library in a plugin [here](https://github.com/J1b1x/ReplayExample). The library supports **reversed watching**, **world changes**, **multiple world recording** and has an included **event log** for stuff like deaths or significant game events.

NOTE
----

[](#note)

Using a replay system like this can cause performance issues, especially if you record multiple worlds at once, which i would NOT recommend.

This is a Network based Replay API, means it's not supposed to be used as a recorder and replayer at once on the same server.

However, if you have any issues, ideas or feature requests, just [create an issue](https://github.com/J1b1x/Replay/issues/new).

API
---

[](#api)

### Recorder

[](#recorder)

#### Recording

[](#recording)

To handle the replay recording use the functions in the [RecordHandler](https://github.com/J1b1x/Replay/blob/master/src/Jibix/Replay/replay/recorder/RecordHandler.php) class.

```
public function record(RecordSettings $settings, World $world, GameDetails $details): Recorder;

public function stopRecording(World $world, ?Closure $onComplete = null): void;

public function isRecording(World $world): bool;

public function getRecorder(World $world): ?Recorder;

public function getRecordings(): array;

public function changeRecordingWorld(Recorder $recorder, World $world): void;
```

#### Actions

[](#actions)

To add your own action, use the [ActionHandler](https://github.com/J1b1x/Replay/blob/master/src/Jibix/Replay/replay/action/ActionHandler.php).

```
ActionHandler::getInstance()->registerAction(
    new EntitySigmaAction()
);

class EntitySigmaAction extends EntityAction{
    protected const ID = CustomActionIds::ENTITY_SIGMA; //like 21 or something

    private string $sigma;

    public static function create(int $entityId, string $sigma): self{
        $action = new self();
        $action->entityId = $entityId;
        $action->sigma = $sigma;
        return $action;
    }

    public function serialize(BinaryStream $stream): void{
        parent::serialize($stream);
        $stream->putString($this->sigma);
    }

    public function deserialize(BinaryStream $stream): void{
        parent::deserialize($stream);
        $this->sigma = $stream->getString();
    }

    public function handle(Replay $replay): void{
        if (!$entity = $replay->getEntity($this->entityId)) return; //don't ask me how tf this is even possible
        $entity->setDisplayName($this->sigma);
    }

    public function handleReversed(Replay $replay): ?Action{
        return self::create($this->entityId, $replay->getEntity($this->entityId)?->getDisplayName());
    }
}

$recorder->addAction(EntitySigmaAction::create($entity->getId(), "Absolute SIGMA!!!!"));
```

#### Event Log

[](#event-log)

To add your own events to a replay, for example a "bed break" event for bed wars, use the [EventLogHandler](https://github.com/J1b1x/Replay/blob/master/src/Jibix/Replay/replay/log/EventLogHandler.php).

```
EventLogHandler::getInstance()->registerEventLog(
    new BedBreakEvent()
);

class BedBreakEvent extends EventLog{
    protected const ID = CustomEventLogIds::BED_BREAK_EVENT; //like 3 for example

    private string $playerName;
    private string $team; //could be "red" or "blue" or whatever
    private int $playerId;

    public static function create(Player $player, string $team): self{
        $data = new self();
        $data->playerName = $player->getDisplayName();
        $data->playerName = $team;
        $data->playerId = $player->getId();
        return $data;
    }

    public static function getName(): string{
        return "beds";
    }

    public static function getTickOffset(): int{ //This is the time offset you get teleported to before the event happened (like 4 * 20 is 4 seconds before they broke the bed)
        return 4 * 20;
    }

    public function getDisplayData(): string{
        return "§c" . $this->playerName . "§8 broke a bed of team§6 " . $this->team);
    }

    public function serialize(BinaryStream $stream): void{
        $stream->putString($this->playerName);
        $stream->putString($this->team);
        $stream->putInt($this->playerId);
    }

    public function deserialize(BinaryStream $stream): void{
        $this->playerName = $stream->getString();
        $this->team = $stream->getString();
        $this->playerId = $stream->getInt();
    }

    public function handle(Replay $replay): void{
        $replay->getWatcher()->teleport($replay->getEntity($this->playerId)->getPosition());
    }
}

$recorder->addEventLog(new BedBreakEvent($player, $team));
```

### Replayer

[](#replayer)

#### Replaying

[](#replaying)

To handle the replay watching use the [Replay events](https://github.com/J1b1x/Replay?tab=readme-ov-file#replay-events) and the functions in the [Replay](https://github.com/J1b1x/Replay/blob/master/src/Jibix/Replay/replay/replayer/Replay.php) class.

```
    public static function play(ReplaySettings $settings, Player $player, ReplayInformation $information): void;

    public function end(): void;

    public function skip(ReplayPlayDirection $direction, int $ticks): void;

    public function skipToTick(int $tick): void;

    public function getPlayDirection(): ReplayPlayDirection;

    public function setPlayDirection(ReplayPlayDirection $playDirection): void;

    public function getSpeed(): float;

    public function setSpeed(float $speed): void;

    public function isPaused(): bool;

    public function togglePaused(): bool;

    public function getEventLogs(): array;

    public function getWatcher(): Player;

    public function getWorld(): ?World;

    public function getEntity(int $entityId): ?ReplayEntity;

    public function getEntities(): array;

    public function getSettings(): ReplaySettings;
```

#### Replay Events

[](#replay-events)

- ReplayStartEvent
- ReplayEndEvent
- ReplayRestartEvent
- ReplayTogglePauseEvent
- ReplayChangeDirectionEvent

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 70% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/64813399?v=4)[Jibix](/maintainers/J1b1x)[@J1b1x](https://github.com/J1b1x)

---

Top Contributors

[![J1b1x](https://avatars.githubusercontent.com/u/64813399?v=4)](https://github.com/J1b1x "J1b1x (14 commits)")[![poggit-bot](https://avatars.githubusercontent.com/u/22427965?v=4)](https://github.com/poggit-bot "poggit-bot (6 commits)")

### Embed Badge

![Health badge](/badges/jibix-replay/health.svg)

```
[![Health](https://phpackages.com/badges/jibix-replay/health.svg)](https://phpackages.com/packages/jibix-replay)
```

###  Alternatives

[iamcal/php-emoji

This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying them using HTML.

1.3k528.3k](/packages/iamcal-php-emoji)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
