1. Go to this page and download the library: Download milpa/live-tui 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/ */
milpa / live-tui example snippets
use Milpa\Live\Tui\NodeRenderers\DataTableRenderer;
use Milpa\Live\ValueObjects\Tui\{TuiBounds, TuiNode, TuiRenderContext};
$frame = (new DataTableRenderer())->render(
new TuiNode('routes', 'data-table', props: [
// `columns` are declarations, not labels: a list of plain strings
// renders nothing.
'columns' => [
['key' => 'method', 'label' => 'method'],
['key' => 'path', 'label' => 'path'],
],
'rows' => [
['method' => 'GET', 'path' => '/'],
['method' => 'PUT', 'path' => '/agency/api/account'],
],
]),
new TuiRenderContext(new TuiBounds(0, 0, 48, 6)),
);
echo implode(PHP_EOL, $frame->lines);
use Milpa\Live\Tui\VirtualTerminalBuffer;
$previous = new VirtualTerminalBuffer(80, 24);
$current = new VirtualTerminalBuffer(80, 24);
$current->writeFrame($bounds, $frame);
foreach ($current->diff($previous)->changes as $change) {
// Only these rows ever reach the terminal.
printf("\033[%d;1H%s", $change['row'] + 1, $change['line']);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.