1. Go to this page and download the library: Download othyn/php-time-remaining 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/ */
othyn / php-time-remaining example snippets
use Othyn\TimeRemaining\TimeRemaining;
$timeRemaining = new TimeRemaining(100);
sleep(30); // Simulate some work being done.
$formattedProgress = $timeRemaining->getFormattedProgress(50);
echo $formattedProgress; // Output: [50% - 50 / 100][~ 0h 0m 30s remaining]
thyn\TimeRemaining\TimeRemaining;
$totalItems = 100;
$timeRemaining = new TimeRemaining($totalItems);
thyn\TimeRemaining\TimeRemaining;
$timeRemaining = new TimeRemaining();
// Code that fetches total items as $totalItems
$timeRemaining->setTotalItems($totalItems);