{"id":23902972,"url":"https://github.com/marcomilon/micro-form","last_synced_at":"2025-07-25T20:03:58.064Z","repository":{"id":62507911,"uuid":"115054476","full_name":"marcomilon/micro-form","owner":"marcomilon","description":"A tool to generate an HTML Form from a JSON file","archived":false,"fork":false,"pushed_at":"2021-02-14T19:28:02.000Z","size":95,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T21:11:15.829Z","etag":null,"topics":["composer","form-builder","form-generator","html-form","html-inputs","json","json-form","json-form-php","jsonforms","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcomilon.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":"2017-12-21T22:57:17.000Z","updated_at":"2024-03-20T16:21:22.000Z","dependencies_parsed_at":"2022-11-02T12:46:12.882Z","dependency_job_id":null,"html_url":"https://github.com/marcomilon/micro-form","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomilon%2Fmicro-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomilon%2Fmicro-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomilon%2Fmicro-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomilon%2Fmicro-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcomilon","download_url":"https://codeload.github.com/marcomilon/micro-form/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248318929,"owners_count":21083751,"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":["composer","form-builder","form-generator","html-form","html-inputs","json","json-form","json-form-php","jsonforms","php"],"created_at":"2025-01-04T22:51:21.677Z","updated_at":"2025-04-11T00:22:18.895Z","avatar_url":"https://github.com/marcomilon.png","language":"PHP","readme":"# micro-form\n\nMicro-form is a library to translate any datasource into into html form elements. Only Json Objects can be use as datasources.\n\n### Installation\n\nFirst you need to install Composer. You may do so by following the instructions at [getcomposer.org](https://getcomposer.org/download/). After that run\n\n\u003e composer require fullstackpe/micro-form\n\nIf you prefer you can create a composer.json in your project folder.\n\n```json\n{\n    \"require\": {\n        \"fullstackpe/micro-form\": \"^3.0\"\n    }\n}\n```\n\n### How it works?\n\nCreate a `jsform` object.\n\n```\nuse micro\\FormFactory;\n$jsonForm = FormFactory::jsonForm();\necho $jsonForm-\u003erender($json);\n```\n\nthen call render to get the form elements. The render method accepts a Json Object.\n\n**Examples**\n\n**Input**\n\n```php \n\u003c?php\n\n$json = '[\n    {\n        \"tag\": \"input\",\n        \"type\": \"text\",\n        \"name\": \"username\",\n        \"class\": \"form-control\"\n    }\n]';\n\nuse micro\\FormFactory;\n$jsonForm = FormFactory::jsonForm();\necho $jsonForm-\u003erender($json);\n```\n\n*output*\n\n```html \n\u003cinput type=\"text\" name=\"username\" class=\"form-control\"\u003e\n```\n\n**Textarea**\n\n```php \n\u003c?php\n\n$json = '[\n    {\n        \"tag\": \"textarea\",\n        \"id\": \"story\",\n        \"name\": \"story\",\n        \"rows\": \"5\",\n        \"cols\": \"33\",\n        \"value\": \"It was a dark and stormy night...\"\n    }\n]';\n\nuse micro\\FormFactory;\n$jsonForm = FormFactory::jsonForm();\necho $jsonForm-\u003erender($json);\n```\n\n*output*\n\n```html\n\u003ctextarea id=\"story\" name=\"story\" rows=\"5\" cols=\"33\"\u003e\nIt was a dark and stormy night...\n\u003c/textarea\u003e\n```\n\n**Select**\n\n```php \n\u003c?php\n\n$json = '[\n    {\n        \"tag\": \"select\",\n        \"name\": \"pets\",\n        \"id\": \"pet-select\",\n        \"value\": [\n            {\n                \"tag\": \"option\",\n                \"label\": \"--Please choose an option--\",\n                \"value\": \"\"\n            },\n            {\n                \"tag\": \"option\",\n                \"label\": \"Dog\",\n                \"value\": \"dog\"\n            },\n            {\n                \"tag\": \"option\",\n                \"label\": \"Cat\",\n                \"value\": \"cat\"\n            }\n        ]\n    }\n]';\n\nuse micro\\FormFactory;\n$jsonForm = FormFactory::jsonForm();\necho $jsonForm-\u003erender($json);\n```\n\n*output*\n\n```html\n\u003cselect name=\"pets\" id=\"pet-select\"\u003e\n    \u003coption value=\"\"\u003e--Please choose an option--\u003c/option\u003e\n    \u003coption value=\"dog\"\u003eDog\u003c/option\u003e\n    \u003coption value=\"cat\"\u003eCat\u003c/option\u003e\n\u003c/select\u003e\n```\n\n### Contribution\n\nFeel free to contribute! Just create a new issue or a new pull request.\n\n### License\n\nThis library is released under the MIT License.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcomilon%2Fmicro-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcomilon%2Fmicro-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcomilon%2Fmicro-form/lists"}