Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcomilon/micro-form
A tool to generate an HTML Form from a JSON file
https://github.com/marcomilon/micro-form
composer form-builder form-generator html-form html-inputs json json-form json-form-php jsonforms php
Last synced: 2 days ago
JSON representation
A tool to generate an HTML Form from a JSON file
- Host: GitHub
- URL: https://github.com/marcomilon/micro-form
- Owner: marcomilon
- License: mit
- Created: 2017-12-21T22:57:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-14T19:28:02.000Z (almost 4 years ago)
- Last Synced: 2024-12-14T01:23:15.380Z (24 days ago)
- Topics: composer, form-builder, form-generator, html-form, html-inputs, json, json-form, json-form-php, jsonforms, php
- Language: PHP
- Homepage:
- Size: 92.8 KB
- Stars: 15
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# micro-form
Micro-form is a library to translate any datasource into into html form elements. Only Json Objects can be use as datasources.
### Installation
First you need to install Composer. You may do so by following the instructions at [getcomposer.org](https://getcomposer.org/download/). After that run
> composer require fullstackpe/micro-form
If you prefer you can create a composer.json in your project folder.
```json
{
"require": {
"fullstackpe/micro-form": "^3.0"
}
}
```### How it works?
Create a `jsform` object.
```
use micro\FormFactory;
$jsonForm = FormFactory::jsonForm();
echo $jsonForm->render($json);
```then call render to get the form elements. The render method accepts a Json Object.
**Examples**
**Input**
```php
render($json);
```*output*
```html
```
**Textarea**
```php
render($json);
```*output*
```html
It was a dark and stormy night...
```
**Select**
```php
render($json);
```*output*
```html
--Please choose an option--
Dog
Cat```
### Contribution
Feel free to contribute! Just create a new issue or a new pull request.
### License
This library is released under the MIT License.