coding-libs / zkteco-php
A package for managing ZKTeco device.
Requires
- php: ^8.0
Requires (Dev)
- phpunit/phpunit: ^8.0|^9.3|^10.4
This package is auto-updated.
Last update: 2025-08-11 13:29:35 UTC
README
Warning
⚠️ This repository is not recommended for use in production. ⚠️
This repository is currently in development and may contain bugs or incomplete features. Use at your own risk and do not deploy to a production environment.
About zkteco-php
The zkteco-php library provides a robust solution for php/laravel developers to interface with ZK BioMetric Fingerprint Attendance Devices. Its user-friendly API allows seamless extraction of data, such as registered users, logs, and device versions. Developers can also add users, retrieve real-time logs, and clear attendance records. Using a socket connection, the library ensures fast and reliable data exchange. Whether creating an attendance system or a time-and-attendance management application, zkteco-js is the essential tool for integrating biometric devices efficiently.
Installation
composer require coding-libs/zkteco-php
Usage Example
// Uncomment the line below if you are not using a PHP framework and need to manually load Composer dependencies. // require_once "vendor/autoload.php"; use CodingLibs\ZktecoPhp\Libs\ZKTeco; $zktecoLib = new Zkteco('192.168.1.1'); //$zktecoLib = new Zkteco(ip:'192.168.1.1', port:4370, shouldPing:false, timeout:25, password:12345); // Password means CMD Key $zkteco->connect(); $zktecoLib->vendorName(); // "ZKTeco Inc. $zktecoLib->deviceName(); // "F22/ID $zktecoLib->serialNumber(); // "BOCK201261276 $zktecoLib->pinWidth(); // "14 $zktecoLib->faceFunctionOn(); // "0 $zktecoLib->platform(); // "ZLM60_TFT $zktecoLib->fmVersion(); // "10 $zktecoLib->ssr(); // "1 $zktecoLib->version(); // "Ver 6.60 Sep 19 2019 $zktecoLib->workCode(); // "0 $zktecoLib->getFingerprint(1); $zktecoLib->getUsers(); // users $zktecoLib->getAttendances(); // attendances logs $zktecoLib->getTime(); // device time $zktecoLib->clearAdminPriv(); // Removes the admin privileges from the current user. $zktecoLib->clearAllUsers(); // clear all users
We have introduced some unique methods.
$zktecoLib->getAttendances(function ($item){ // condition goes there return $item; }); // attendances logs $zktecoLib->deleteUsers(function($user){ // condition goes there }); // delete users conditionally $zktecoLib->deviceId(); // "0 $zktecoLib->getDeviceData('TCPPort'); // "4370 $zktecoLib->setCustomData('my_company_name', "Coding Labs"); // You can set any custom value as you want $zktecoLib->getCustomData("my_company_name"); // "Coding Labs $zktecoLib->setPushCommKey("iclock_push_commKey"); // It may be useful for iClock authentication. $zktecoLib->getPushCommKey(); // "iclock_push_commKey # and more...
Contributing
Please see CONTRIBUTING for details.
Security
If you've found a bug regarding security please mail codinglibs4u@gmail.com instead of using the issue tracker.
Alternatives
License
The MIT License (MIT). Please see License File for more information.