PHPackages                             ninjaknights/drawerapi - 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. ninjaknights/drawerapi

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

ninjaknights/drawerapi
======================

PocketMine-MP virion designed to draw shapes and text in the world using the DebugDrawerPacket.

0.0.8(5mo ago)12342GPL-3.0PHP

Since Jul 7Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/ninjaknights/DrawerAPI)[ Packagist](https://packagist.org/packages/ninjaknights/drawerapi)[ RSS](/packages/ninjaknights-drawerapi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (8)Used By (0)

DrawerAPI
=========

[](#drawerapi)

[![GitHub license](https://camo.githubusercontent.com/d439496669dfafc54f5c34af2197954f3be91d4fe7b2f18e363c016af92569b4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e696e6a616b6e69676874732f447261776572415049)](https://github.com/ninjaknights/DrawerAPI/blob/main/LICENSE)[![GitHub stars](https://camo.githubusercontent.com/8f879246b16da44ac597e73df215c80b5d3cad8e6483657332388498e6f5513e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e696e6a616b6e69676874732f447261776572415049)](https://github.com/ninjaknights/DrawerAPI/stargazers)[![GitHub forks](https://camo.githubusercontent.com/04528d363b0cb3d563c19dfbf6bf2257a3da4928e8c191ecbfd8e34e434cbbaa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6e696e6a616b6e69676874732f447261776572415049)](https://github.com/ninjaknights/DrawerAPI/network/members)[![GitHub issues](https://camo.githubusercontent.com/e00004529543557fc9be4b4cb88cb25125e39f733a27520ab4bea23b874d5b54/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6e696e6a616b6e69676874732f447261776572415049)](https://github.com/ninjaknights/DrawerAPI/issues)[![Github downloads](https://camo.githubusercontent.com/95cc1b763b52d583e70ca7995f992e409ae26709f09d74f392f2245a5092b617/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f6e696e6a616b6e69676874732f4472617765724150492f746f74616c)](https://github.com/ninjaknights/DrawerAPI/releases)

 [ ![DrawerAPI Icon](assets/icon.png?raw=true)](https://github.com/ninjaknights/DrawerAPI)
 **DrawerAPI** is a PocketMine-MP virion designed to draw shapes and text in the world using the `DebugDrawerPacket`.
 [View on Microsoft Docs](https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/debug-utilities/debugshape?view=minecraft-bedrock-experimental)
 [View on Packagist](https://packagist.org/packages/ninjaknights/drawerapi)

---

Setup
-----

[](#setup)

Before using the API, you **must register** it in your plugin’s `onLoad()` or `onEnable()` method:

```
use ninjaknights\drawerAPI\DrawerAPI;
class MyPlugin extends PluginBase {
	public function onLoad(): void {
		if(!DrawerAPI::isRegistered()){
			DrawerAPI::register($this);
		}
	}
}
```

---

#### Creating Shapes

[](#creating-shapes)

You can draw various shapes using the provided shape classes.

### ➤ TextShape

[](#-textshape)

```
use ninjaknights\drawerAPI\shape\Text;
// Create a text shape
Text::create(
	$world, // Player/World Players to show the text to
	"Hello, World!", // The text to display
	new Vector3(0, 100, 0), // Position in the world or set to null to use player's position
	ShapeColor::WHITE, // Color name "red" or #f0f0f0, f0f0f0 or ShapeColor enum works too
);
```

### ➤ CircleShape

[](#-circleshape)

```
use ninjaknights\drawerAPI\shape\Circle;
// Create a text shape
Circle::create(
	$world, // Player/World Players to show the text to
	new Vector3(0, 100, 0), // Position in the world or set to null to use player's position
	1.0, // Scale of the shape
	"#ff0000", // Color name or #f0f0f0, f0f0f0 or ShapeColor enum works too
	3 // 3 means it will have 3 sides so a triangle, default is 20 (not sure)
);
```

### ➤ CubeShape (Debug Cube)

[](#-cubeshape-debug-cube)

> This does not generate a ID

```
use ninjaknights\drawerAPI\shape\Cube;
// Create a cube shape
Cube::create(
	$world, // Player/World Players to show the text to
	new Vector3(0, 100, 0), // Position in the world or set to null to use player's position
	"Hi there", // text of the shape
	"#ff0000", // Color name or #f0f0f0, f0f0f0 or ShapeColor enum works too
	10 // lifespan meaning it will stay in the world for 10 seconds after spawning
);
```

---

Available Shapes
----------------

[](#available-shapes)

ShapeDescription`Text`Renders a floating text label`Arrow`Renders a directional arrow`Box`Renders a 3D bounding box`Line`Renders a straight line between points`Sphere`Renders a full sphere`Circle`Renders a circle or polygon`Cube`Renders a DebugCube shapeAvailable Colors
----------------

[](#available-colors)

You can use color **names**, **enum**, or **hex codes** (e.g. `"red"`, `"light_gray"`, `"#ff0000"`, `"f0f0f0"`).
All names are **case-insensitive**.

Color NameHex CodeEnum`white``#f0f0f0``ShapeColor::WHITE``orange``#f9801d``ShapeColor::ORANGE``magenta``#c74ebd``ShapeColor::MAGENTA``light_blue``#3ab3da``ShapeColor::LIGHT_BLUE``yellow``#fed83d``ShapeColor::YELLOW``lime``#80c71f``ShapeColor::LIME``pink``#f38baa``ShapeColor::PINK``gray``#474f52``ShapeColor::GRAY``light_gray``#9d9d97``ShapeColor::LIGHT_GRAY``cyan``#169c9c``ShapeColor::CYAN``purple``#8932b8``ShapeColor::PURPLE``blue``#3c44aa``ShapeColor::BLUE``brown``#835432``ShapeColor::BROWN``green``#5e7c16``ShapeColor::GREEN``red``#b02e26``ShapeColor::RED``black``#1d1d21``ShapeColor::BLACK`---

Managing Shapes
---------------

[](#managing-shapes)

### ➤ Clear Shapes

[](#-clear-shapes)

You can clear all shapes of a specific type for a viewer or world using the `clearAll` method:

```
use ninjaknights\drawerAPI\DrawerAPI;
DrawerAPI::clearAll(ShapeType::TEXT, $world); // Clears all text shapes for the specified world
DrawerAPI::clearAll(ShapeType::ARROW, $player); // Clears all arrow shapes for the specified player
```

### ➤ Remove Specific Shape by ID

[](#-remove-specific-shape-by-id)

```
use ninjaknights\drawerAPI\shape\Text;
Text::removeById($world, 1); // Removes the text shape with ID 1 for the player/world players
```

### ➤ Remove CubeShape

[](#-remove-cubeshape)

```
use ninjaknights\drawerAPI\shape\Cube;
Text::clear($world); // Removes the cube shape for the player/world players
```

---

ID Management
-------------

[](#id-management)

### ➤ Get ID List

[](#-get-id-list)

```
use ninjaknights\drawerAPI\DrawerAPI;
use ninjaknights\drawerAPI\ShapeType;

$activeIds = DrawerAPI::getIdList(ShapeType::LINE);
foreach ($activeIds as $id) {
	echo "Line shape active with ID: $id\n";
}
```

### ➤ Check if an ID is Active

[](#-check-if-an-id-is-active)

```
DrawerAPI::isActiveId(ShapeType::CIRCLE, 5); // Returns true/false
```

### ➤ Get Last Generated ID

[](#-get-last-generated-id)

```
$lastId = DrawerAPI::getId(ShapeType::BOX);
```

---

API Reference
-------------

[](#api-reference)

### ➤ DrawerAPI Methods

[](#-drawerapi-methods)

MethodDescription`register(PluginBase $plugin)`Initializes and registers the DrawerAPI. Required before use.`isRegistered(): bool`Returns `true` if the API is initialized.`getColor(?string $color): Color`Converts a color name or hex or enum (e.g., `"red"`, `"#ff0000"`, `"ShapeColor::WHITE"`) to a `Color` object.`getId(ShapeType $type): int`Gets the last generated ID for a shape type.`isActiveId(ShapeType $type, int $id): bool`Checks if an ID is currently active.`getIdList(ShapeType $type): array`Lists all currently active IDs for a shape type.`removeId(ShapeType $type, int $id): void`Manually unregisters an ID (usually done automatically).`clearAll(World|Player $viewer, ?ShapeType $type): void`Despawns and removes all shapes of a specific type or all types.`despawnPacketByID(World|Player $viewer, int $id): void`Removes a single shape from view by its ID.`sendPacket(World|Player $viewer, DebugDrawerPacket $packet): void`Sends a custom packet to a player or world.### ➤ ShapeColor Methods

[](#-shapecolor-methods)

MethodDescription`ShapeColor::fromString(string $name): ?ShapeColor`Converts a color name into a `ShapeColor` enum. Returns `null` if invalid.`ShapeColor::("COLOR")->toColor(): Color`Converts the enum value to a `pocketmine\color\Color` instance.`ShapeColor::("COLOR")->name`Returns the constant name (e.g., `WHITE`, `RED`, etc.).`ShapeColor::("COLOR")->value`Returns the constant value (e.g., `white`, `red`, etc.).```
$pmColor = ShapeColor::WHITE->toColor(); // pocketmine\color\Color
// or
$color = ShapeColor::fromString("cyan");
if ($color !== null) {
	$pmColor = $color->toColor(); // pocketmine\color\Color
}
```

---

Notes
-----

[](#notes)

- Color names are case-insensitive and use the `ShapeColor` enum internally.
- Hex values like `"#ffffff"` or `"ff0000"` are also accepted.
- Either store the id when using `create()` as it returns the id or use `getId`

---

📄 License
---------

[](#-license)

This project is licensed under the [GPL-3.0 License](https://github.com/ninjaknights/DrawerAPI/blob/main/LICENSE).

---

📬 Contact
---------

[](#-contact)

- Have questions or need help? Join out [Discord](https://discord.gg/ZKfh5ycJrU) Server
- Found a bug or wish to suggest some changes? [Open an issue](https://github.com/ninjaknights/DrawerAPI/issues)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance73

Regular maintenance activity

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 82.6% 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 ~26 days

Recently: every ~38 days

Total

7

Last Release

150d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f0d5579b7c2fb478089d823eac4b262aa0f583c4c9b2b5d7e03b88ad6f25ac9?d=identicon)[HydroGames-dev](/maintainers/HydroGames-dev)

---

Top Contributors

[![HydroGames-dev](https://avatars.githubusercontent.com/u/69600115?v=4)](https://github.com/HydroGames-dev "HydroGames-dev (19 commits)")[![jeantkg](https://avatars.githubusercontent.com/u/102908437?v=4)](https://github.com/jeantkg "jeantkg (3 commits)")[![poggit-bot](https://avatars.githubusercontent.com/u/22427965?v=4)](https://github.com/poggit-bot "poggit-bot (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ninjaknights-drawerapi/health.svg)

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

###  Alternatives

[wzulfikar/eloquent-simple-ledger

242.5k](/packages/wzulfikar-eloquent-simple-ledger)[ympact/flux-icons

A package to provide icons from different vendors for Livewire Flux.

116.2k](/packages/ympact-flux-icons)

PHPackages © 2026

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