1. Go to this page and download the library: Download spoova/iotext 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/ */
use spoova\mi\core\classes\Bundle\IOText\IOTextStream;
use spoova\mi\core\classes\Bundle\IOText\IOTextFile;
IOTextStream::init();
IOTextStream::stream_file('/path/to/progress.log', function (IOTextFile $file) {
if ($file->isModified()) {
IOTextStream::stream_view($file->textFromLine($file->lineCount()));
}
if (str_contains($file->text(), 'DONE')) {
$file->stop();
}
}, interval: 0.5);
IOTextStream::close();