PHPackages                             terpz710/apibossbar - 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. [API Development](/categories/api)
4. /
5. terpz710/apibossbar

ActiveLibrary[API Development](/categories/api)

terpz710/apibossbar
===================

02PHP

Since Jul 29Pushed 1y agoCompare

[ Source](https://github.com/Pixals-Bedrock/apibossbar-composer)[ Packagist](https://packagist.org/packages/terpz710/apibossbar)[ RSS](/packages/terpz710-apibossbar/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

apibossbar
==========

[](#apibossbar)

A simple api virion to create, send, modify and use Minecraft's boss mob indicator bars in Plugins for PocketMine-MP

Advantages
----------

[](#advantages)

It is quite easy to use this API

- It uses a single object
- Fluent setters (use multiple functions in 1 line)
- Cleaner code
- Easier to understand
- No worrying about the used entity id
- 2 types of bars (BossBar is same for all players, DiverseBossBar can be modified per player)
- No "API::function()" calls, just object methods
- Changeable entity (Can be used for actual boss mobs i.e.)

Types
-----

[](#types)

There are 2 types of boss bars.

- BossBar: is used for shared data, so all registered players see the same bar.
- DiverseBossBar: is used for unique data, their data can be changed per player. They can also be set in a batch for multiple players, and will use default values if no specific data is set for a player. The default data is set like on a shared BossBar

API &amp; usage
---------------

[](#api--usage)

A very basic example can be seen here: [BossBarTest](https://github.com/thebigsmileXD/BossBarTest). For a more advanced example you could check out [BossAnnouncement](https://github.com/thebigsmileXD/BossAnnouncement)

Create a new boss bar

```
/** @var BossBar */
$bar = new BossBar();
```

Set the title and/or subtitle

```
$bar->setTitle(string $title = "");
$bar->setSubTitle(string $subTitle = "");
```

Set the color

```
// Available Colors:
// RED, PINK, BLUE, GREEN, YELLOW, PURPLE, REBECCA_PURPLE and WHITE
$bar->setColor(BarColor::RED);
```

Set the fill percentage

```
// Half-filled
$bar->setPercentage(0.5);
```

Add and remove players

```
// Single
$bar->addPlayer(Player $player);// This will spawn the bar to the player
$bar->removePlayer(Player $player);
// Multiple
/** @var Player[] $players */
$bar->addPlayers(array $players);
$bar->removePlayers(array $players);
$bar->removeAllPlayers();
```

Hide and show bar

```
/** @var Player[] $players */
$bar->hideFrom(array $players);
$bar->showTo(array $players);
```

Get and set the entity the bar is assigned to

```
/** @var Entity|Player $entity */
$bar->getEntity();
$bar->setEntity(Entity $entity);
$bar->resetEntity();
```

Single line example

```
/** @var Player $player */
$player = Server::getInstance()->getPlayerByName("Steve");
/** @var BossBar */
$bar = (new BossBar())->setTitle("Hello world!")->setSubTitle("Foo Bar")->setPercentage(0.5)->addPlayer($player);
```

---

**DiverseBossBar has some additional methods to set data per player:**

Reset the data to its defaults

```
$bar->resetFor(Player $player);
$bar->resetForAll();
```

Set &amp; get title for players

```
/** @var Player[] $players */
$bar->setTitleFor(array $players);
$bar->setSubTitleFor(array $players);
$bar->getTitleFor(Player $player);
$bar->getSubTitleFor(Player $player);
$bar->getFullTitleFor(Player $player);// Combined and encoded title & subtitle
```

Set percentage for players

```
/** @var Player[] $players */
$bar->setPercentageFor(array $players);
$bar->getPercentageFor(Player $player);
```

Disclaimer &amp; Information
----------------------------

[](#disclaimer--information)

Coded and maintained by XenialDan

Feel free to open issues with suggestions and bug reports. Please leave as much information as possible to help speeding up the debugging of the issues.

This is a full rework of [BossBarAPI](https://github.com/thebigsmileXD/BossBarAPI). Plugins that used this virion should be upgraded to apibossbar ASAP

Colors and overlays do not work due to not being properly implemented in the client (They use data from the resource pack definitions file). #blamemojang for copy-paste leftovers from Minecraft: Java Edition

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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/82214170?v=4)[oPinqzz](/maintainers/oPinqzz)[@oPinqzz](https://github.com/oPinqzz)

---

Top Contributors

[![inxomnyaa](https://avatars.githubusercontent.com/u/8733998?v=4)](https://github.com/inxomnyaa "inxomnyaa (9 commits)")[![Terpz710](https://avatars.githubusercontent.com/u/142659461?v=4)](https://github.com/Terpz710 "Terpz710 (9 commits)")[![poggit-bot](https://avatars.githubusercontent.com/u/22427965?v=4)](https://github.com/poggit-bot "poggit-bot (3 commits)")[![oPinqzz](https://avatars.githubusercontent.com/u/82214170?v=4)](https://github.com/oPinqzz "oPinqzz (2 commits)")

### Embed Badge

![Health badge](/badges/terpz710-apibossbar/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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