1. Go to this page and download the library: Download valiant-bedrock/libforms library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
valiant-bedrock / libforms example snippets
$form = new \libforms\SimpleForm(
title: "Hello, World!",
content: "This is our simple, little form.",
buttons: [
new \libforms\buttons\Button(
text: "Click me!",
onClick: function (Player $player): void { $player->sendMessage("You clicked it!"); }
),
new \libforms\buttons\ImageButton(
text: "I'm shinier! Click me!",
type: \libforms\buttons\image\ImageType::PATH(),
source: "textures/items/diamond",
onClick: function (Player $player): void {
$player->sendMessage("Ooh! Shiny!");
$player->getInventory()->add(VanillaItems::DIAMOND());
}
)
]
);
assert($player instanceof \pocketmine\player\Player);
$form->send($player);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.