PHP code example of flsouto / httextin

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



use FlSouto\HtTextin;
il');
$field->context(['email'=>'[email protected]']);

echo $field;

use FlSouto\HtTextin;
n('email');
$field->readonly(true);

echo $field;

use FlSouto\HtTextin;

$field = new HtTextin('email');
$field->readonly(true);
$field->readonly(false);

echo $field;


$field = new HtTextin('email');
$field->size(40);

echo $field;


$field = new HtTextin('email');
$field->size(40)->placeholder("eg: [email protected]");

echo $field;


$field = new HtTextin('price');
$field->formatter(function($value){
	return '$'.number_format((float)$value, 2, '.',',');
});

$field->context(['price'=>30.9]);

echo $field;


$field = new HtTextin('price');
$field->filters()->strip('$')->replace(',','.')->trim();
$field->context(['price'=>'$ 30,90']);

echo $field->value();


$field = new HtTextin('amount');
$field->filters()->maxval(10, "Cannot exceed 10.");
$field->context(['amount'=>15]);
$field->error(true); // activates error reporting on the UI

echo $field;