1. Go to this page and download the library: Download monomelodies/formulaic 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/ */
monomelodies / formulaic example snippets
use Formulaic\Get;
use Formulaic\Search;
use Formulaic\Button\Submit;
class MyForm extends Get
{
public function __construct()
{
$this[] = (new Search('q'))->isRequired();
$this[] = new Submit('Go!', 'submit');
}
}
$form = new MyForm;
echo $form;
$form = new MyForm;
$form = new MyForm;
if ($form->valid()) {
// ...Perform the search...
}
$form = new MyForm;
if ($errors = $form->errors()) {
// ...Do error handling, or give feedback...
}
use Formulaic\Get;
use Formulaic\Fieldset;
use Formulaic\Search;
use Formulaic\Button\Submit;
class MyForm extends Get
{
public function __construct()
{
$this[] = new Fieldset('Global search', function($fieldset) {
$fieldset[] = new Search('q');
});
$this[] = new Fieldset('Search by ID', function($fieldset) {
$fieldset[] = new Search('id');
});
$this[] = new Submit('Go!');
}
}
<form method="get">
<?=$form['Global search']
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.