PHP code example of inteve / forms

1. Go to this page and download the library: Download inteve/forms 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/ */

    

inteve / forms example snippets


$form['date'] = new Inteve\Forms\DateInput('Date:', 'Error message for invalid date.');
$form['date']->setDefaultValue(new \DateTimeImmutable('2018-01-01 20:18'));
$form['date']->setDefaultValue(new \DateTime('2018-01-01 20:18'));

$form['date']->getValue(); // DateTimeImmutable|NULL

$form['datetime'] = new Inteve\Forms\DateTimeInput('Datetime:', 'Error message for invalid datetime.');
$form['datetime']->setDefaultValue(new \DateTimeImmutable('2018-01-01 20:18'));
$form['datetime']->setDefaultValue(new \DateTime('2018-01-01 20:18'));

$form['datetime']->getValue(); // DateTimeImmutable|NULL

$form['datetime'] = new Inteve\Forms\DateTimeInput('Datetime:', $errorMessage, 'Europe/Prague');

$form['time'] = new Inteve\Forms\TimeInput('Time:', 'Error message for invalid time.');
$form['time']->setDefaultValue(new \DateTimeImmutable('2018-01-01 20:18'));
$form['time']->setDefaultValue(new \DateTime('2018-01-01 20:18'));
$form['time']->setDefaultValue(new \DateInterval('PT20H18M'));

$form['time']->getValue(); // DateInterval|NULL