PHP code example of flsouto / htfield

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

    

flsouto / htfield example snippets



use FlSouto\HtField;
ield{

	// Set field as rs()-> 'render' method
	function render(){
		echo "<input ".$this->attrs." />";
	}

}



ld = new MyField('email');

echo $field;


$field = new MyField('email');
$field->attrs(['id'=>'email_field']);

echo $field;


$field = new MyField('email');
$field->attrs(['id'=>'email_field']);

echo $field->id();


$field = new MyField('address');

echo $field->name();


$field = new MyField('username');
$field->context(['username'=>'Jack']);

echo $field->process()->output;


$field = new MyField('user[contact][email]');
$field->context(['user'=>['contact'=>['email'=>'[email protected]']]]);

echo $field->process()->output;


$field = new MyField('description');
$input = $field
	->context(['description'=>'This is just a test'])
	->value();

echo $input;


$field = new MyField('name');
$error = $field->error;