tes / biotime-sdk
Framework-agnostic PHP SDK for the ZKTeco BioTime device API — token auth, attendance, employees, devices, departments, positions, areas, and resignations.
Requires
- php: ^8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- psr/simple-cache: ^1.0 || ^2.0 || ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- illuminate/support: ^10.0 || ^11.0
- phpunit/phpunit: ^10.0
Suggests
- illuminate/support: Required only if you want the Laravel service provider (auto-registered singleton + publishable config).
Provides
None
Conflicts
None
Replaces
None
README
A modern, framework-agnostic PHP SDK for the ZKTeco BioTime device REST API — token auth, attendance, employees, devices, departments, positions, areas, and resignations.
📖 Full documentation: thomas-emad.github.io/biotime-sdk
What it does
BioTime SDK wraps token authentication, automatic re-authentication on 401, pagination, and typed DTO mapping around the BioTime REST API, so you write:
$biotime = new BioTime(); $employee = $biotime->employees()->find('EMP001'); echo $employee->firstName;
instead of hand-rolling HTTP calls, token headers, and manual retries.
Install
composer require tes/biotime-sdk
Requires PHP ^8.1. In Laravel apps, the service provider is auto-discovered — nothing else to register. See Laravel installation.
Quick start
use BioTime\BioTime; $biotime = new BioTime(); // reads BIOTIME_* env vars, or config/biotime.php // Attendance for a date range, every page, as typed DTOs $records = $biotime->attendances()->all('2026-07-01', '2026-07-31'); foreach ($records as $record) { echo "{$record->empCode} punched {$record->punchState} at {$record->punchTime}\n"; } // Employees $employee = $biotime->employees()->find('EMP001'); // Devices, departments, positions, areas $devices = $biotime->devices()->all(); $departments = $biotime->departments()->all();
Full walkthrough: Getting Started → Quick Start.
Supported resources
Documentation
This README is intentionally short. The full documentation site covers configuration, authentication, pagination, filtering, DTOs, error handling, Laravel integration, advanced usage, a complete API reference, real-world examples, and troubleshooting:
👉 thomas-emad.github.io/biotime-sdk
- Getting Started
- Core Concepts (auth, pagination, filtering, DTOs, errors, caching)
- Resources
- Laravel Integration
- Advanced Usage
- API Reference
- Examples
- Troubleshooting
Links
- Repository: github.com/Thomas-Emad/biotime-sdk
- Packagist: packagist.org/packages/tes/biotime-sdk
- Issues: github.com/Thomas-Emad/biotime-sdk/issues
Contributing
Issues and pull requests are welcome — see Contributing for the full workflow (fork, branch, composer install, composer test, PR).
License
The MIT License (MIT). See LICENSE for details.