PHP Classes

PHP JSON Form Builder: Generate a HTML form definition in JSON format

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 469 All time: 6,016 This week: 126Up
Version License PHP version Categories
json-form-generator 1.3MIT/X Consortium ...5HTML, PHP 5


This class can generate a HTML form definition in JSON format.

It takes as parameter the path of a JSON file and parses it to extract the definition of the form options as well the options of all the inputs contained in the form.

The class generates HTML for the form and its inputs.

Innovation Award
PHP Programming Innovation award nominee
April 2020
Number 3
Many Web applications need to render forms to get information from their users.

This class provides an easy way to generate HTML forms from files with definitions read from a file in JSON format.

Manuel Lemos
Picture of Arash Soleimani
  Performance   Level  
Name: Arash Soleimani <contact>
Classes: 4 packages by
Country: The Netherlands The Netherlands
Age: ???
All time rank: 286476 in The Netherlands The Netherlands
Week rank: 398 Up6 in The Netherlands The Netherlands Up
Innovation award
Innovation award
Nominee: 2x


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LeoMoon JSON Form Generator</title>
    <link rel="stylesheet" href="" crossorigin="anonymous" />
        body{ padding:50px; }
        label{ display:block; }
        input{ padding:5px; }
        select{ width:100px; padding:5px;}
$form = new Form(['file'=>'./example_form.json']);


JSON Form Generator

LeoMoon JFG generates HTML form tags from JSON file/input. JFG supports all types and attributes of form tags.


Companies change their software every couple of years. If they have too many pages and forms, they need to redesign the whole thing again. But when you are using JSON format, you don't have to worry about redesigning everything. You just write a new JSON render engine in a new programming language or framework. Here is an example:



  $form = new Form(['file'=>'./example_form.json']);

Sample JSON file

    "name": "formName",
    "title": "Registration form",
    "description": "simple JFG example.",
    "method": "post",
    "action": "",
    "properties": {
      "firstName": {
        "type": "input",
        "title": "First name",
        "value": "test",
        "required": true,
      "lastName": {
        "type": "input",
        "title": "Last name",
        "disabled": true
      "age": {
        "type": "number",
        "title": "Age",
      "bio": {
        "type": "input",
        "title": "Bio",
      "password": {
        "type": "password",
        "title": "Password",
        "min": 3
      "language": {
        "type": "select",
        "title": "Language",
      "submit": {
        "type": "submit",
        "title": "Save Form",

  • json-form-generator-sample.jpg
  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file example_form.json Data Auxiliary data
Plain text file form.class.php Class Class source
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,016
This week:126Up