1. Go to this page and download the library: Download soloterm/screen 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/ */
soloterm / screen example snippets
use SoloTerm\Screen\Screen;
// Create a screen with dimensions (columns, rows)
$screen = new Screen(80, 24);
// Write text and ANSI escape sequences
$screen->write("Hello, \e[1;32mWorld!\e[0m");
// Move cursor and add more text
$screen->write("\e[5;10HPositioned text");
// Get the rendered content
echo $screen->output();
$screen = new Screen(80, 24); // width, height
$screen->write("Text and ANSI codes");
use SoloTerm\Screen\Screen;
// Create a screen for a popup/panel
$popup = new Screen(40, 10);
$popup->write("Popup content here...");
// Position the parent terminal's cursor where you want the popup
echo "\e[5;20H"; // Move to row 5, column 20
// Render the popup - it will use relative positioning from this point
echo $popup->output();
$screen = new Screen(80, 24);
$screen->write("Initial content");
// Get the full output and capture the sequence number
$output = $screen->output();
$seqNo = $screen->getLastRenderedSeqNo();
// ... later, after some updates ...
$screen->write("\e[5;1HUpdated line");
// Only get the changed lines (with cursor positioning)
$diff = $screen->output($seqNo);
// Move cursor to position (row 5, column 10)
$screen->write("\e[5;10H");
// Move cursor up 3 lines
$screen->write("\e[3A");
// Save and restore cursor position
$screen->write("\e7"); // Save
$screen->write("More text");
$screen->write("\e8"); // Restore
// Bold red text
$screen->write("\e[1;31mImportant message\e[0m");
// Background colors
$screen->write("\e[44mBlue background\e[0m");
// 256-color support
$screen->write("\e[38;5;208mOrange text\e[0m");
// RGB colors
$screen->write("\e[38;2;255;100;0mCustom color\e[0m");
// Clear screen
$screen->write("\e[2J");
// Clear from cursor to end of line
$screen->write("\e[0K");
// Insert lines
$screen->write("\e[2L");
// Scroll up
$screen->write("\e[2S");