Download the PHP package pup/placeholderapi without Composer

On this page you can find all versions of the php package pup/placeholderapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package placeholderapi

PlaceholderAPI

A placeholder-parsing library for PocketMine-MP plugins. Register placeholders as closures or classes, use them in messages with {identifier} or {identifier:params} syntax, and parse them with or without player context.

Installation

As a virion

Direct include Copy src/pup/placeholderapi into your plugin's source directory.

Initialization

$manager is a static singleton. getManager() lazily initializes it if initialize() was never called, so registering a placeholder without an explicit initialize() call still works. Calling it explicitly in onEnable() doesn't change behavior, it just makes the setup order visible in your code.

Parsing

A placeholder that requires a player and is parsed without one is left as literal text ({player_name} stays as-is). Same for a :params value passed to a placeholder that doesn't support parameters.

Registering placeholders

Closures

Classes

Use PlayerPlaceholder or ServerPlaceholder when the logic is more than a couple of lines, or when you want it unit-testable independent of the registration call.

PlayerPlaceholder::process() already returns "" if $player is null, before your processPlayer() runs, so you don't need to null-check inside it.

Built-in placeholders

Player (require a player)

Placeholder Description Example
{player} / {player_name} Player's name Steve
{player_display} Display name §aSteve
{player_health} Current health 20.0
{player_max_health} Max health 20.0
{player_food} Food level 20
{player_level} XP level 5
{player_xp} Total XP 250
{player_gamemode} Game mode Survival
{player_ping} Network ping 42
{player_x} X coordinate 123.45
{player_y} Y coordinate 64.00
{player_z} Z coordinate -789.12
{player_world} World name world

Server

Placeholder Description Example
{server_motd} Server MOTD My Server
{server_online} Online players 15
{server_max} Max players 20
{server_tps} Server TPS 19.95

Colors and formatting

{black} {dark_blue} {dark_green} {dark_aqua} {dark_red} {dark_purple} {gold} {gray} {dark_gray} {blue} {green} {aqua} {red} {light_purple} {yellow} {white}

{bold} {italic} {underline} {strikethrough} {obfuscated} {reset}

Parameters

Recursion

A placeholder's return value is parsed again, so it can contain other placeholders:

Depth is capped at 10 (PlaceholderManager::MAX_RECURSION_DEPTH). Past that, whatever is left unresolved is returned as-is instead of infinitely looping. If a placeholder's process() throws, the manager catches it and returns the original {tag} unmodified rather than propagating the exception, so a broken custom placeholder won't crash whatever is sending the message. It's still worth logging inside your placeholder if you want to know it's failing.

Gradients

Other utilities

Full example

Migrating from v1

v1-style calls still work unchanged:

is equivalent to:

requiresPlayer and supportsParameters default to false, so old registrations behave the same way they did before those flags existed.

Notes

Credits

Originally written for the Kyro core (Pupggers). Refactored in v2.0.


All versions of placeholderapi with dependencies

PHP Build Version
Package Version
Requires axolotl-pm/pocketmine-mp Version ^5.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pup/placeholderapi contains the following files

Loading the files please wait ...