Skip to content

BioTime SDKPHP SDK for the ZKTeco BioTime API

A modern, framework-agnostic PHP SDK for the ZKTeco BioTime REST API — authentication, pagination, DTOs, and Laravel integration, out of the box.

What it does

BioTime devices and servers expose a REST API for attendance transactions, employees, devices (terminals), departments, positions, areas, and resignations — but every call needs a bearer token, that token expires, pagination has to be walked by hand, and every response is an untyped array.

BioTime SDK handles all of that for you:

  • Authenticates automatically — obtains a device token on first use, caches it, and transparently re-authenticates on a 401.
  • Handles pagination — every list resource exposes list() for a single page and all() to walk every page for you.
  • Returns typed DTOs — readonly objects like Employee, Device, AttendanceRecord, with the full raw payload still available via ->raw.
  • Normalizes errors — every failed request throws ApiException (or AuthenticationException) with the HTTP status and raw response body attached.
  • Works anywhere — a plain, framework-agnostic core, with an optional auto-discovered Laravel service provider.

Who it's for

PHP developers integrating a ZKTeco BioTime device or BioTime server into an HR system, attendance dashboard, payroll pipeline, or any application that needs employee, device, or attendance data — in plain PHP or inside a Laravel app.

Supported PHP versions

TIP

BioTime SDK requires PHP ^8.1 and the ext-json extension. It depends on guzzlehttp/guzzle ^7.0 for HTTP and psr/simple-cache for optional token caching.

Install it

bash
composer require tes/biotime-sdk

A minimal example

php
use BioTime\BioTime;

$biotime = new BioTime(); // reads BIOTIME_* env vars, or config/biotime.php

$employee = $biotime->employees()->find('EMP001');

echo $employee->firstName;

That's a full authenticated request — no manual token handling, no manual JSON decoding.

Supported resources

ResourceWhat it covers
AttendancesPunch/transaction records, date-range queries, CSV/TXT/XLS export
EmployeesCRUD, area/department reassignment, resignation, biometric templates
DevicesTerminal CRUD, reboot, clear commands, upload/resync actions
DepartmentsDepartment CRUD
PositionsJob position CRUD
AreasArea/site CRUD
ResignationsResignation CRUD and reinstatement

Laravel support

BioTime SDK ships an optional, auto-discovered Laravel service provider. Install the package in a Laravel app and BioTime::class is already bound in the container — no manual registration required. See Laravel integration.

Where to go next

Distributed under the MIT License.