1. Go to this page and download the library: Download bakame/tokei 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/ */
bakame / tokei example snippets
use Bakame\Tokei\Duration;
use Bakame\Tokei\DurationFormat;
use Bakame\Tokei\Time;
$target = Duration::of(hours: 7, minutes: 33);
$alreadyDone = Duration::of(hours: 5, minutes: 17);
$remaining = $target->sub($alreadyDone);
$startedNewShiftAt = Time::at(hour: 21, minute: 31);
$shouldStopAt = $startedNewShiftAt->add($remaining);
echo "I have to work ", $target->format(DurationFormat::Compact), " today", PHP_EOL;
echo "I have already worked for ", $alreadyDone->format(DurationFormat::Compact), PHP_EOL;
echo "I still have to work ", $remaining->format(DurationFormat::Compact), PHP_EOL;
echo "If I start working again at ", $startedNewShiftAt->format(DurationFormat::Timer), PHP_EOL;
echo "I will end today's shit at ", $shouldStopAt->format(DurationFormat::Timer), PHP_EOL;
// Gives the following:
/**
* I have to work 7h33m today
* I have already worked for 5h17m
* I still have to work 2h16m
* If I start working again at 21:31:00
* I will end today's shit at 23:47:00
*/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.