PHP code example of geggleto / form-builder

1. Go to this page and download the library: Download geggleto/form-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

geggleto / form-builder example snippets


$builder = new Builder(new Factory()); //default is Bootstrap 3
$root = $builder->build((new CsvParser())->parseSchemaCsvToArray("form.csv"), "Login");
$builder->write($rootElement, './userLoginForm.php');

$builder = new Builder(new Factory()); //default is Bootstrap 3
$root = $builder->build((new JsonParser())->parseSchemaCsvToArray("form.json"), "Login");
$builder->write($rootElement, './userLoginForm.php');

$builder = new Builder(new Factory()); //default is Bootstrap 3

$schema = []; 

$schema[] = $builder->getSchemaForColumn('username')
    ->setPlaceholder('Username');
    ->setType('text');

$schema[] = $builder->getSchemaForColumn('password')
    ->setPlaceholder('Password');
    ->setType('password');

$schema[] = $builder->getSchemaForColumn('domain')
    ->setPlaceholder('Password');
    ->setType('select')
    ->setOptions([
        "example.com" => 1,
        "beta.example.com" => 2,
        "theta.example.com" => 3,
    ]);

$rootElement = $builder->build($schema, 'Login');

$builder->write($rootElement, './userLoginForm.php');