{"id":15142811,"url":"https://github.com/mefrreex/formconstructor-pm","last_synced_at":"2026-01-20T21:07:37.106Z","repository":{"id":217949715,"uuid":"744126150","full_name":"MEFRREEX/FormConstructor-PM","owner":"MEFRREEX","description":"Library for easy creating and handling of forms for PocketMine-MP","archived":false,"fork":false,"pushed_at":"2024-01-19T12:00:56.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T21:49:39.323Z","etag":null,"topics":["form","formapi","pmmp","pmmp-plugin","pmmp-plugins","pmmp5","pocketmine","pocketmine-mp","pocketmine-plugin","pocketmine-plugins"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MEFRREEX.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-16T17:11:59.000Z","updated_at":"2024-06-08T22:36:19.000Z","dependencies_parsed_at":"2024-01-18T23:08:08.609Z","dependency_job_id":"818d31f9-3a1d-48ce-817e-9d80121caa88","html_url":"https://github.com/MEFRREEX/FormConstructor-PM","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.4285714285714286,"last_synced_commit":"4729587e0c241c56a04ee2e2baac308a9df3989d"},"previous_names":["mefrreex/formconstructor-pm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MEFRREEX%2FFormConstructor-PM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MEFRREEX%2FFormConstructor-PM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MEFRREEX%2FFormConstructor-PM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MEFRREEX%2FFormConstructor-PM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MEFRREEX","download_url":"https://codeload.github.com/MEFRREEX/FormConstructor-PM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509164,"owners_count":20950233,"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":["form","formapi","pmmp","pmmp-plugin","pmmp-plugins","pmmp5","pocketmine","pocketmine-mp","pocketmine-plugin","pocketmine-plugins"],"created_at":"2024-09-26T10:00:39.236Z","updated_at":"2026-01-20T21:07:37.060Z","avatar_url":"https://github.com/MEFRREEX.png","language":"PHP","readme":"![logo](https://github.com/MEFRREEX/FormConstructor-PM/assets/83061703/cdbd20c2-7046-4636-a6c7-6482beb51ecf)\n\nThis plugin is a rewritten version of the FormConstructor plugin for Nukkit on PocketMine-MP API 5.0.0\n\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE) \n[![Version](https://img.shields.io/badge/Version-2.0.1-brightgreen)](https://github.com/MEFRREEX/FormConstructor-PM/releases/tag/1.0.0)\n\n🤔 Introduction\n------------- \n\nLibrary is designed to simplify the creation and handling of forms.\nIt has a few key advantages over other form libraries:\n\n- Forms are handled using a callback function that is passed in when the form itself is created.\n- For each button in SimpleForm we can set a callback function.\n- In SimpleForm we get a button object as a response, where we can get its name and index.\n- In CustomForm we can mark elements with an identifier to conveniently get this element in its handler. We can get element by id and its index.\n- For each form we can set its closing handler.\n\n🛠 Examples\n-------------\n\nCreating a SimpleForm:\n\n```php\n$form = new SimpleForm(\"Sample title\");\n$form-\u003eaddContent(\"New content line\");\n\n// Easiest way to add a button\n$form-\u003eaddButton(new Button(\"Button\", function (Player $pl, Button $b) {\n        $pl-\u003esendMessage(\"Button clicked: \" . $b-\u003egetName() . \" (\" . $b-\u003egetIndex() . \")\");\n    }))\n\n    // Button with image\n    -\u003eaddButton((new Button(\"Button with image\"))\n        -\u003esetImage(ImageType::PATH, \"textures/items/diamond\"))\n\n    // Another way to add a button\n    -\u003eaddButton((new Button(\"Another button\"))\n        -\u003esetImage(ImageType::PATH, \"textures/blocks/stone\")\n        -\u003eonClick(function (Player $pl, Button $b) {\n            $pl-\u003esendMessage(\"Another button clicked: \" . $b-\u003egetName() . \" (\" . $b-\u003egetIndex() . \")\");\n        }));\n\n// Setting the form close handler\n$form-\u003esetCloseHandler(function (Player $pl) {\n    $pl-\u003esendMessage(\"You closed the form!\");\n});\n\n$form-\u003esend($player);\n```\n\nCreating a ModalForm:\n\n```php\n$form = new ModalForm(\"Test modal form\");\n$form-\u003eaddContent(\"New content line\");\n\n$form-\u003esetPositiveButton(\"Positive button\")\n     -\u003esetNegativeButton(\"Negative button\");\n\n// Setting the form handler\n// Result returns true if a positive button was clicked and false if a negative button was clicked\n$form-\u003esetHandler(function (Player $pl, bool $result) {\n    $pl-\u003esendMessage(\"You clicked \" . ($result ? \"correct\" : \"wrong\") . \" button!\");\n});\n\n// Setting the form close handler\n$form-\u003esetCloseHandler(fn(Player $pl) =\u003e $pl-\u003esendMessage(\"You closed the form!\"));\n\n$form-\u003esend($player);\n```\n\nCreating a CustomForm:\n\n```php\n$form = new CustomForm(\"Test custom form\");\n\n$form-\u003eaddContent(\"Test label\")\n    -\u003eaddElement(\"input\", (new Input(\"Input\"))\n        -\u003esetPlaceholder(\"Text\")\n        -\u003esetDefaultValue(\"Default value\"))\n    -\u003eaddElement(\"slider\", new Slider(\"Slider\", 1, 100, 1, 1))\n    -\u003eaddElement(\"stepslider\", (new StepSlider(\"Step slider\"))\n        -\u003eaddText(\"1\")\n        -\u003eaddText(\"2\")\n        -\u003eaddText(\"3\"))\n    -\u003eaddElement(\"dropdown\", (new Dropdown(\"Dropdown\"))\n        -\u003eaddText(\"Element 1\")\n        -\u003eaddText(\"Element 2\")\n        -\u003eaddText(\"Element 3\"))\n    -\u003eaddElement(\"dropdown1\", (new Dropdown(\"Second dropdown\"))\n        -\u003eaddElement(new SelectableElement(\"Option 1\"))\n        -\u003eaddElement(new SelectableElement(\"Option 2\"))\n        -\u003eaddElement(new SelectableElement(\"Option with value\", 15)))\n    -\u003eaddElement(\"toggle\", new Toggle(\"Toggle\", false));\n\n// Setting the form handler\n$form-\u003esetHandler(function (Player $pl, CustomFormResponse $response) {\n    $input = $response-\u003egetInput(\"input\")-\u003egetValue();\n\n    $slider = $response-\u003egetSlider(\"slider\")-\u003egetValue();\n    $stepslider = $response-\u003egetStepSlider(\"stepslider\")-\u003egetValue();\n    $dropdown = $response-\u003egetDropdown(\"dropdown\")-\u003egetValue();\n\n    // Getting the value we set in SelectableElement\n    $dropdownValue = $response-\u003egetDropdown(\"dropdown1\")-\u003egetValue()-\u003egetValue();\n\n    $toggle = $response-\u003egetToggle(\"toggle\")-\u003egetValue();\n\n    $pl-\u003esendMessage(\"Input: \" . $input . \", Slider: \" . $slider . \", Step Slider: \" . $stepslider . \", Dropdown: \" . $dropdown . \", Toggle: \" . $toggle);\n    $pl-\u003esendMessage(\"Second dropdown value: \" . $dropdownValue);\n});\n\n$form-\u003esend($player);\n```\n\nDownload Example plugin: https://github.com/MEFRREEX/FormConstructor-PM-Example\n\n📋 Events\n-------------\n| Name                 | Cancellable | Description                      |\n|----------------------|-------------|----------------------------------|\n| PlayerFormSendEvent  | true        | Called when a form is sent       |\n| PlayerFormCloseEvent | false       | Called when the form is closed   |\n\nExample:\n```php\npublic function onFormSend(PlayerFormSendEvent $event) {\n    // Getting a player\n    $player = $event-\u003egetPlayer();\n    // Getting the form\n    $form = $event-\u003egetForm();\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmefrreex%2Fformconstructor-pm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmefrreex%2Fformconstructor-pm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmefrreex%2Fformconstructor-pm/lists"}