PHPackages                             valres/pmtoolbox - 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. valres/pmtoolbox

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

valres/pmtoolbox
================

Best utilities libs for PocketMine-MP plugins.

v1.0.1(2d ago)01↑2900%MITPHPPHP &gt;=8.1

Since Jun 7Pushed 2d agoCompare

[ Source](https://github.com/Root-Productions/PM-Toolbox)[ Packagist](https://packagist.org/packages/valres/pmtoolbox)[ RSS](/packages/valres-pmtoolbox/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

PMToolBox
=========

[](#pmtoolbox)

PMToolBox is a small PocketMine-MP toolbox library. It provides utilities for manager-based plugin structure, task helpers and an optional RCON interface.

Setup
-----

[](#setup)

Register the toolbox from your plugin lifecycle:

```
use pocketmine\plugin\PluginBase;
use valres\toolbox\ToolboxLoader;

final class Main extends PluginBase {
    protected function onLoad(): void {
        ToolboxLoader::load($this);
    }

    protected function onEnable(): void {
        ToolboxLoader::enable($this);
    }

    protected function onDisable(): void {
        ToolboxLoader::disable();
    }
}
```

By default, managers are loaded from the `manager` directory under your plugin namespace.

If your managers are elsewhere:

```
ToolboxLoader::load($this, "modules");
ToolboxLoader::enable($this);
```

If you do not want to use the manager system:

```
ToolboxLoader::load($this, loadManagers: false);
ToolboxLoader::enable($this, enableManagers: false);
```

Managers
--------

[](#managers)

Create managers by extending `BaseManager`.

```
namespace myplugin\manager;

use valres\toolbox\manager\BaseManager;
use valres\toolbox\manager\attribute\Manager;
use valres\toolbox\manager\attribute\ManagerPriority;
use valres\toolbox\manager\attribute\ManagerPriorityEnum;

#[Manager(name: "Economy", version: "1.0.0")]
#[ManagerPriority(ManagerPriorityEnum::PRIORITY_HIGH)]
final class EconomyManager extends BaseManager {
    public function onLoad(): void {
        // Light startup work.
    }

    public function init(): void {
        // Enable-time setup.
    }

    public function save(): void {
        // Persist data before shutdown.
    }
}
```

Dependencies
------------

[](#dependencies)

Use `ManagerDependsOn` when a manager must be initialized after another one.

```
use valres\toolbox\manager\attribute\ManagerDependsOn;

#[ManagerDependsOn(["Economy"])]
final class ShopManager extends BaseManager {
    // ...
}
```

The resolver detects duplicate manager names, missing dependencies and circular dependencies.

Auto Register
-------------

[](#auto-register)

Managers can auto-register commands and listeners from folders next to the manager class.

```
use valres\toolbox\manager\attribute\AutoRegister;
use valres\toolbox\manager\attribute\AutoRegisterAll;
use valres\toolbox\manager\attribute\AutoRegisterType;

#[AutoRegister(AutoRegisterType::COMMANDS)]
#[AutoRegister(AutoRegisterType::LISTENERS)]
final class GameplayManager extends BaseManager {
    // ...
}

#[AutoRegisterAll]
final class ProfileManager extends BaseManager {
    // Registers command/ and listener/.
}
```

Expected folder layout:

```
src/myplugin/manager/ProfileManager.php
src/myplugin/manager/command/ProfileCommand.php
src/myplugin/manager/listener/ProfileListener.php

```

Access
------

[](#access)

```
$economy = ToolboxLoader::getManager("Economy");
$shop = ToolboxLoader::getManagerOf(ShopManager::class);

if (ToolboxLoader::hasManager("Economy")) {
    // ...
}
```

You can also access the handler directly:

```
$handler = ToolboxLoader::getManagerHandler();
```

Each manager also behaves like a singleton automatically. You do not need to add a trait in your manager class:

```
$economy = EconomyManager::getInstance();

if (EconomyManager::hasInstance()) {
    EconomyManager::getInstance()->save();
}
```

The singleton instance is registered when the manager is discovered and reset when managers are disabled.

RCON
----

[](#rcon)

RCON is optional and can be started during enable:

```
use valres\toolbox\rcon\RconSettings;

ToolboxLoader::enable($this, new RconSettings(
    address: "0.0.0.0",
    port: 19132,
    password: "secret"
));
```

Or with the helper:

```
ToolboxLoader::enable($this, RconSettings::default("secret", 19132));
```

Packets
-------

[](#packets)

PMToolBox includes a small packet API inspired by LibPacket/SimplePacketHandler: register handlers for specific packet classes instead of writing long `instanceof` chains.

### Monitor

[](#monitor)

Use a monitor when you only want to observe packets. Return values are ignored.

```
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\LoginPacket;
use valres\toolbox\ToolboxLoader;

$monitor = ToolboxLoader::createPacketMonitor();

$monitor->monitorIncoming(function(LoginPacket $packet, NetworkSession $session): void {
    // Debug or inspect the packet.
});
```

### Interceptor

[](#interceptor)

Use an interceptor when you want to cancel or modify packets before normal handling. Return `false` to cancel the packet event.

```
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\AdventureSettingsPacket;
use valres\toolbox\ToolboxLoader;

$interceptor = ToolboxLoader::createPacketInterceptor();

$interceptor->interceptIncoming(function(AdventureSettingsPacket $packet, NetworkSession $session): bool {
    return true; // false cancels the DataPacketReceiveEvent.
});
```

### Handler Classes

[](#handler-classes)

```
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\LoginPacket;
use pocketmine\network\mcpe\protocol\Packet;
use valres\toolbox\packet\PacketHandlerInterface;

final class LoginPacketHandler implements PacketHandlerInterface {
    public function getPacketIds(): array {
        return [LoginPacket::class];
    }

    public function handle(Packet $packet, NetworkSession $session): bool {
        return true;
    }
}

ToolboxLoader::createPacketInterceptor()->registerIncoming(new LoginPacketHandler());
```

### Attributes

[](#attributes)

You can also register public methods with attributes.

```
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\LoginPacket;
use valres\toolbox\packet\attribute\IncomingPacket;
use valres\toolbox\packet\attribute\OutgoingPacket;
use valres\toolbox\packet\attribute\PacketHandler;
use valres\toolbox\packet\PacketDirection;

final class PacketHandlers {
    #[IncomingPacket(LoginPacket::class)]
    public function onLogin(LoginPacket $packet, NetworkSession $session): bool {
        return true;
    }

    #[OutgoingPacket]
    public function onAnyOutgoing(LoginPacket $packet, NetworkSession $session): void {
    }

    #[PacketHandler(PacketDirection::INCOMING, LoginPacket::class)]
    public function onLoginWithGenericAttribute(LoginPacket $packet, NetworkSession $session): bool {
        return true;
    }
}

ToolboxLoader::createPacketInterceptor()->registerAnnotated(new PacketHandlers());
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.4

v1.0.1PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7081098?v=4)[Valerie Respaut](/maintainers/Valres)[@ValRes](https://github.com/ValRes)

---

Top Contributors

[![ValresMC](https://avatars.githubusercontent.com/u/104681026?v=4)](https://github.com/ValresMC "ValresMC (5 commits)")

### Embed Badge

![Health badge](/badges/valres-pmtoolbox/health.svg)

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

###  Alternatives

[facuz/laravel-themes

Theme will help you organize your themes inside Laravel projects easily and maintain its related assets, layouts and partials for the theme in single directory. (Based on teepluss/theme)

13743.6k2](/packages/facuz-laravel-themes)[ackintosh/snidel

A multi-process container. It looks like multi-thread-ish.

1051.2k](/packages/ackintosh-snidel)[heptacom/heptaconnect-portal-base

HEPTAconnect base dataset that every other portal is based on

1025.2k15](/packages/heptacom-heptaconnect-portal-base)[infocyph/intermix

A lightweight PHP DI container, invoker, serializer, and utility toolkit.

137.3k1](/packages/infocyph-intermix)[codespede/simple-multi-threader

122.6k](/packages/codespede-simple-multi-threader)

PHPackages © 2026

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