1. Go to this page and download the library: Download lagdo/ui-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/ */
lagdo / ui-builder example snippets
use Lagdo\UiBuilder\BuilderInterface;
class View
{
/**
* @var BuilderInterface
*/
protected $html;
/**
* @param BuilderInterface
*/
public function __construct(BuilderInterface $html)
{
$this->html = $html;
}
/**
* Get the HTML code of a simple form
*
* @param array $formData
* @return string
*/
public function getSimpleForm(array $formData)
{
return $this->html->build(
$this->html->form(
$this->html->formRow(
$this->html->formCol(
$this->html->formLabel($this->html->text('Name'))
->setFor('name')
)
->width(4),
$this->html->formCol(
$this->html->formInput()
->setType('text')
->setName('name')
->setPlaceholder('Name')
->setValue($formData['name'])
)
->width(8)
),
$this->html->formRow(
$this->html->formCol(
$this->html->formLabel($this->html->text('Description'))
->setFor('description')
)
->width(4),
$this->html->formCol(
$this->html->formTextarea($this->html->text($formData['description']))
->setRows('10')
->setName('description')
->setWrap('on')
->setSpellcheck('false')
)
->width(8)
)
)
->responsive(true)->setId('form-id')
);
}
}
use Lagdo\UiBuilder\Bootstrap\Bootstrap3\Builder;
$view = new View(new Builder());
use Lagdo\UiBuilder\Bootstrap\Bootstrap4\Builder;
$view = new View(new Builder());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.