PHP code example of jeremiah-shaulov / html-to-vt100
1. Go to this page and download the library: Download jeremiah-shaulov/html-to-vt100 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/ */
jeremiah-shaulov / html-to-vt100 example snippets
100\Vt100;
// to output
echo Vt100::from_html('aaa<b style="color:magenta">BBB</b>ccc<br>');
// to error log
error_log(Vt100::from_html('aaa<b style="color:magenta">BBB</b>ccc<br>'));
100\Vt100;
$FILENAME = '/tmp/myapp.log';
// 1. Write some messages to file
file_put_contents($FILENAME, Vt100::from_html("<b>IMPORTANT</b> message<br>"));
file_put_contents($FILENAME, Vt100::from_html("<i style='color:blue'>Notice</i> message<br>"), FILE_APPEND);
file_put_contents($FILENAME, Vt100::from_html("<b style='color:yellow; background-color:black'>Warning</b> message<br>"), FILE_APPEND);
// 2. Read and present to browser
echo Vt100::to_html(file_get_contents($FILENAME));
public static function from_html($str); // Converts HTML to VT100 escape codes.
public static function to_html($str); // Converts VT100 escape codes produced by from_html() back to HTML.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.