PHP code example of arifur9993 / attendance-engine
1. Go to this page and download the library: Download arifur9993/attendance-engine 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/ */
arifur9993 / attendance-engine example snippets
use Arifur9993\AttendanceEngine\Engine;
use Arifur9993\AttendanceEngine\Types\Punch;
use Arifur9993\AttendanceEngine\Types\ShiftConfig;
use Arifur9993\AttendanceEngine\Types\ResolveDayInput;
$result = Engine::resolveDay(new ResolveDayInput(
date: '2026-06-01',
punches: [
new Punch(at: '2026-06-01T08:57:00+06:00'),
new Punch(at: '2026-06-01T18:04:00+06:00'),
],
shift: new ShiftConfig(start: '09:00', end: '18:00', graceIn: 10),
));
echo $result->status; // 'present'
echo $result->workedMinutes; // 547
echo $result->lateByMinutes; // 0
echo $result->otMinutes; // 4
// JSON-ready for your API
return response()->json($result); // implements JsonSerializable