{"id":15143476,"url":"https://github.com/dresnite/easyui","last_synced_at":"2026-03-17T15:20:30.055Z","repository":{"id":45254261,"uuid":"281477433","full_name":"dresnite/easyui","owner":"dresnite","description":"📖 An intuitive and easy-to-use form library for PocketMine-MP","archived":false,"fork":false,"pushed_at":"2023-10-18T22:37:32.000Z","size":41,"stargazers_count":29,"open_issues_count":3,"forks_count":13,"subscribers_count":0,"default_branch":"pm5","last_synced_at":"2025-01-30T20:40:50.210Z","etag":null,"topics":["mcpe","minecraft","pmmp","pocketmine","pocketmine-mp-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dresnite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-21T18:44:33.000Z","updated_at":"2024-01-24T21:27:31.000Z","dependencies_parsed_at":"2022-09-10T04:04:09.907Z","dependency_job_id":null,"html_url":"https://github.com/dresnite/easyui","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dresnite%2Feasyui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dresnite%2Feasyui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dresnite%2Feasyui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dresnite%2Feasyui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dresnite","download_url":"https://codeload.github.com/dresnite/easyui/tar.gz/refs/heads/pm5","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237882172,"owners_count":19381176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcpe","minecraft","pmmp","pocketmine","pocketmine-mp-plugin"],"created_at":"2024-09-26T10:01:48.000Z","updated_at":"2025-10-23T20:30:23.997Z","avatar_url":"https://github.com/dresnite.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasyUI\n\nEasyUI is an intuitive and easy-to-use form library for PocketMine-MP. Designed to let you focus on your project and not on how the library works.\n\n## Download\n\nYou can download the virion in [Poggit](https://poggit.pmmp.io/ci/dresnite/easyui/libEasyUI).\n\n## Code examples\n\n### General rules\n\nAll the closures passed to EasyUI classes must declare a variable of the class Player as first and only argument, except for the CustomForm submit listener, which also requires FormResponse as second parameter.\n\n### SimpleForm\n\nCreating a form with a button without an icon:\n```php\n$form = new SimpleForm(\"This is the title\");\n$form-\u003eaddButton(new Button(\"Say hi\", null, function(Player $player) {\n    $player-\u003esendMessage(\"Hello!\");\n}));\n$player-\u003esendForm($form);\n```\n\nCreating a form with a button with an icon:\n```php\n$form = new SimpleForm(\"This is the title\");\n$form-\u003eaddButton(new Button(\"Press me!\", new ButtonIcon(\"https://introduce-the-image-url.here\"), function(Player $player) {\n    $player-\u003esendMessage(\"Hey! Thanks for pressing me :)\");\n}));\n$player-\u003esendForm($form);\n```\n\nCreating a form with a header text (optional):\n```php\nnew SimpleForm(\"This is the title\", \"This is the header text\");\n```\n\nControlling what happens when a form closes (optional):\n```php\n$form-\u003esetCloseListener(function(Player $player) {\n    echo \"The form was closed!\";\n})\n```\n\n### ModalForm\n\nCreating a modal form and handling what happens when the player presses \"accept\" or \"deny\":\n```php\n$form = new ModalForm(\"The title goes here!\", \"Do you want this plugin to save you a lot of time?\");\n$form-\u003esetAcceptListener(function(Player $player) {\n    $player-\u003esendMessage(\"Great! Keep building good software\");\n});\n\n$form-\u003esetDenyListener(function(Player $player) {\n    $player-\u003esendMessage(\"Whatever :/\");\n});\n\n```\n\nYou can also change the text of the buttons:\n```php\n$form-\u003esetAcceptText(\"Yes\");\n$form-\u003esetDenyText(\"Yesn't\");\n```\n\n### CustomForm\n\nCreating a custom form with an input and a dropdown\n```php\n$form = new CustomForm(\"This is the title!\");\n$form-\u003eaddElement(\"my_text\", new Input(\"This is the input header text!\"));\n\n$dropdown = new Dropdown(\"This is the dropdown header text\");\n$dropdown-\u003eaddOption(new Option(\"broadcast\", \"Broadcast message\"));\n$dropdown-\u003eaddOption(new Option(\"send_to_myself\", \"Send message to myself\"));\n\n$form-\u003eaddElement(\"what_to_do\", $dropdown);\n\n$form-\u003esetSubmitListener(function(Player $player, FormResponse $response) {\n    $submittedText = $response-\u003egetInputSubmittedText(\"my_text\");\n    $submittedOption = $response-\u003egetDropdownSubmittedOptionId(\"what_to_do\");\n    if($submittedOption === \"send_to_myself\") {\n        $player-\u003esendMessage($submittedText);\n    } elseif($submittedOption === \"broadcast\") {\n        foreach($player-\u003egetServer()-\u003egetOnlinePlayers() as $onlinePlayer) {\n            $onlinePlayer-\u003esendMessage(\"[BROADCAST] $submittedText\");\n        }\n    }\n});\n``` \n\n## Object oriented approach\n\nIn some cases, the forms are huge and mess up the code. In those cases, you can use a more object oriented approach to keep the code as clean as possible.   \n\n### SimpleForm\n\n```php\nclass ExampleForm extends SimpleForm {\n\n    public function __construct() {\n        parent::__construct(\"Form title\");\n    }\n\n    protected function onCreation(): void {\n        $button = new Button(\"A very very big button\");\n        $button-\u003esetIcon(new ButtonIcon(\"https://a-cool-url.i.think\"));\n        $button-\u003esetSubmitListener(function(Player $player) {\n            $player-\u003esendMessage(\"Making this form was so easy!\");\n        });\n        $this-\u003eaddButton($button);\n    }\n\n}\n```\n\n### ModalForm\n\n```php\nclass ExampleForm extends ModalForm {\n    \n    public function __construct() {\n        parent::__construct(\"The title\", \"The content text\");\n    }\n\n    protected function onAccept(Player $player): void {\n        $player-\u003esendMessage(\"You pressed 'Accept' \u003c3\");\n    }\n\n    protected function onDeny(Player $player): void {\n        $player-\u003esendMessage(\"You pressed 'Deny' \u003e:(\");\n    }\n\n}\n```\n**NOTE**: `onCreation()` is also available on ModalForms.\n\n### CustomForm\n```php\nclass ExampleForm extends CustomForm {\n\n    public function __construct() {\n        parent::__construct(\"The title goes here\");\n    }\n\n    public function onCreation(): void {\n        // You can add the elements here\n    }\n\n    public function onSubmit(Player $player, FormResponse $response): void {\n        // You can modify the response here\n    }\n\n\n}\n```\n\nThen you can send the forms as you normally would with:\n```php\n$player-\u003esendForm(new ExampleForm());\n```\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdresnite%2Feasyui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdresnite%2Feasyui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdresnite%2Feasyui/lists"}