PHP code example of thomasleconte / form-generator
1. Go to this page and download the library: Download thomasleconte/form-generator 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/ */
thomasleconte / form-generator example snippets
$generator = new FormGenerator();
// generate(objectOrClassName, form action, fields options, form options)
$generator->generate(User::class, "/register");
$generator->show();
$user = new User("Elon", "Musk", 50);
$generator->generate($user, "/register");
$generator->show();
...
$generator->generate($user, "/register");
...
$generator->addAttribute("firstname", "placeholder", "Your first name");
$generator->updateAttribute("firstname", "placeholder", "I don't know what to write here");
$generator->show();