Build Minecraft Bedrock UI
with clean PHP
EasyUIBuilder is a fluent PHP library that generates Minecraft Bedrock Edition JSON UI files. Stop writing raw JSON — write expressive code instead.
composer require refaltor/easy-ui-builderFeatures
Everything for Bedrock UI development
A complete toolkit covering every Bedrock UI element, with auto-generation of resource pack files.
Fluent API
Chainable methods for every UI element. Expressive, readable code that maps to JSON UI concepts.
All Bedrock Types
16 element types: Label, Panel, Button, Image, Grid, StackPanel, Toggle, Slider, EditBox, and more.
Animations
Alpha, offset, size, color, clip and flip_book animations with 30+ easings and chaining.
Data Bindings
Global, view, collection and visibility bindings to connect your UI to Minecraft's data layer.
Auto-Generation
One command generates _ui_defs.json, server_form.json, and all individual screen files.
Color Utilities
Predefined colors, RGB, random, pastel, and complementary. No more manual RGBA arrays.
9-Point Anchoring
Position elements with anchor_from/anchor_to using 9 anchor points plus pixel offsets.
Variables
Conditional variables for platform and input-mode adaptive layouts from a single codebase.
RootBuild System
Organize screens as classes, register them, and generate entire resource packs.
Getting Started
Your first screen in 10 lines
Install via Composer, create a Root, add elements with the fluent API, and generate the JSON file. That's it.
Install the package
Requires PHP 8.0+. Install via Composer:
composer require refaltor/easy-ui-builderWrite your first screen
Create a Root, add UI elements with the fluent API, and output the JSON:
use refaltor\ui\builders\Root;
use refaltor\ui\elements\Label;
use refaltor\ui\colors\BasicColor;
$root = Root::create("my_namespace");
$root->addElement(
Label::create("hello", "Hello Minecraft!")
->setFontSize(Label::FONT_EXTRA_LARGE)
->setShadow()
->setColor(BasicColor::yellow())
);
$root->generateAndSaveJson("ui/my_screen.json");Drop into your resource pack
The generated JSON file is a valid Bedrock UI screen, ready to use in any resource pack. Copy it to your pack's ui/ directory.
your_resource_pack/
manifest.json
ui/
_ui_defs.json ← auto-generated
server_form.json ← auto-generated
custom_ui/
my_screen.json ← your screen
Reference
Supported UI elements
Every Bedrock JSON UI element type has a dedicated PHP class with fluent methods.
| Element | Description |
|---|---|
| Label | Text rendering with font size, type, scale, shadow, and color control |
| Panel | Container element with visibility, alpha, clipping, and scissor support |
| Button | Interactive button with 4-state textures and factory system |
| Image | Texture display with UV mapping, 9-slice, tiling, clip, and grayscale |
| Grid | Dynamic grid layout with item templates and configurable fill direction |
| StackPanel | Auto-layout container with vertical or horizontal orientation |
Examples
Real-world usage
Complete game menu
Background, title, player render, button stack, and close button — all in one file:
use refaltor\ui\builders\Root;
use refaltor\ui\elements\{Panel, Label, Button, Image, StackPanel};
use refaltor\ui\elements\utils\{CloseButton, PlayerRender};
use refaltor\ui\colors\BasicColor;
use refaltor\ui\helpers\OrientationHelper;
$root = Root::create();
$mainPanel = Panel::create("main_menu")
->setSizePercentage(100, 100);
// Background with 9-slice
$mainPanel->addChild(
Image::create("bg", "textures/ui/dialog_background_opaque")
->setSizePercentage(100, 100)
->setNinesliceSize(4)
->setLayer(-1)
);
// Title with Minecraft font
$mainPanel->addChild(
Label::create("title", "My Custom Menu")
->setFontSize(Label::FONT_EXTRA_LARGE)
->setFontType(Label::TYPE_MINECRAFT_TEN)
->setShadow()
->setColor(BasicColor::yellow())
->setAnchorFrom(Element::ANCHOR_TOP_MIDDLE)
->setAnchorTo(Element::ANCHOR_TOP_MIDDLE)
->setOffset(0, 15)
);
// Player skin viewer
$mainPanel->addChild(
PlayerRender::create("player_skin")
->setSize(80, 120)
->setAnchorFrom(Element::ANCHOR_LEFT_MIDDLE)
->setAnchorTo(Element::ANCHOR_LEFT_MIDDLE)
->setOffset(20, 0)
);
// Navigation buttons
$stack = StackPanel::create("buttons")
->setOrientation(OrientationHelper::VERTICAL)
->setSize(200, 160)
->setAnchorFrom(Element::ANCHOR_CENTER)
->setAnchorTo(Element::ANCHOR_CENTER);
$stack->enableFactoryButton($root);
foreach (["Play", "Shop", "Settings"] as $label) {
$stack->addChild(
Button::create(strtolower($label) . "_btn", $root)
->setButtonText($label)
->setVisibleIfTitle($label)
->setSize(200, 30)
);
}
$mainPanel->addChild($stack);
$mainPanel->addChild(
CloseButton::create("close")
->setAnchorFrom(Element::ANCHOR_TOP_RIGHT)
->setAnchorTo(Element::ANCHOR_TOP_RIGHT)
->setOffset(-5, 5)
);
$root->addElement($mainPanel);Animations
Add smooth transitions with 30+ easing functions and chain multiple animations together:
use refaltor\ui\components\Animation;
use refaltor\ui\elements\Panel;
// Fade in from transparent
$fadeIn = Animation::alpha("fade_in")
->setFrom(0.0)
->setTo(1.0)
->setDuration(0.5)
->setEasing("in_out_sine");
// Slide from above with bounce
$slideDown = Animation::offset("slide_down")
->setFrom([0, -50])
->setTo([0, 0])
->setDuration(0.3)
->setEasing("out_bounce");
// Chain: fade in, then slide
$fadeIn->setNext($slideDown);
$panel = Panel::create("animated_panel")
->addAnimation($fadeIn);30+ Easings
linear, in_out_sine, out_bounce, elastic, spring...
Chaining
setNext() chains animations into complex sequences
6 Types
Alpha, offset, size, color, clip_ratio, flip_book
Data Bindings
Connect UI elements to Minecraft's data layer with global, view, collection, and visibility bindings:
use refaltor\ui\components\Binding;
use refaltor\ui\elements\Label;
// Bind player name from game data
$playerName = Label::create("player_name_label", "")
->addBinding(
Binding::global("#playername")
->setBindingNameOverride("#text")
);
// Visibility binding: only show if condition met
$alertLabel = Label::create("alert", "Low health!")
->addBinding(
Binding::visibility("#is_low_health")
);
// Collection binding for grid items
$itemName = Label::create("item_name", "")
->addBinding(
Binding::collection("#item_name", "inventory_items")
->setBindingNameOverride("#text")
);RootBuild System
Organize screens as classes implementing the RootBuild interface, then generate everything with a single command:
use refaltor\ui\builders\{Root, RootBuild};
use refaltor\ui\elements\Label;
class MyScreen implements RootBuild
{
public function root(): Root
{
$root = Root::create();
$root->addElement(
Label::create("title", "My Screen")
->setFontSize(Label::FONT_EXTRA_LARGE)
->setShadow()
);
return $root;
}
public function getNamespace(): string
{
return "my_screen";
}
public function getPathName(): string
{
return "./resources/my_pack/";
}
public function titleCondition(): string
{
return "MY_SCREEN";
}
}Generated output
- →
ui/_ui_defs.json— UI definitions registry, auto-updated - →
ui/server_form.json— Server form with title conditions - →
ui/custom_ui/my_screen.json— Your complete screen file
FAQ
Frequently asked questions
What is EasyUIBuilder?
EasyUIBuilder is an open-source PHP library that generates Minecraft Bedrock Edition JSON UI files using a fluent builder pattern. Instead of writing raw JSON by hand, you write clean PHP code and it outputs valid, ready-to-use resource pack UI files.
What version of PHP do I need?
PHP 8.0 or higher is required. The library uses modern PHP features like named arguments, union types, and match expressions.
How do I install it?
Via Composer: run `composer require refaltor/easy-ui-builder`. Alternatively, you can clone the GitHub repository and include the autoloader manually.
What UI elements are supported?
All standard Bedrock JSON UI element types: Label, Panel, Button, Image, Grid, StackPanel, Toggle, Slider, EditBox, ScrollView, Dropdown, InputPanel, Screen, and CustomRender. Plus utility components like CloseButton and PlayerRender.
Can I use this with PocketMine-MP?
Yes. EasyUIBuilder generates standard Bedrock JSON UI files compatible with any Bedrock server including PocketMine-MP. It's perfect for building custom server form UIs and menu screens.
Does it support animations?
Yes. Full animation system supporting alpha, offset, size, color, clip, and flip_book animations with 30+ easing functions and chaining support.
What files are generated?
Three types: _ui_defs.json (UI definitions registry), server_form.json (server form configuration), and individual screen JSON files in ui/custom_ui/ — everything needed for a complete Bedrock resource pack.
Is it free?
Yes, fully open source under the MIT License. Use it freely in personal and commercial projects.
Start building better UI
Join the developers using EasyUIBuilder to create Minecraft Bedrock interfaces faster and cleaner.