Download the PHP package zillur-web/zkteco-php-sdk without Composer
On this page you can find all versions of the php package zillur-web/zkteco-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zillur-web/zkteco-php-sdk
More information about zillur-web/zkteco-php-sdk
Files in zillur-web/zkteco-php-sdk
Package zkteco-php-sdk
Short Description ZKTeco PHP SDK for Laravel - A Laravel package for ZKTeco device integration
License MIT
Informations about the package zkteco-php-sdk
ZKTeco PHP SDK for Laravel & Standalone PHP
A comprehensive PHP package for integrating ZKTeco biometric and access control devices. Works as both a standalone PHP library and as a Laravel package.
Features
- ✅ Standalone PHP usage - no framework required
- ✅ Laravel package integration with service container and Facade
- ✅ Support for multiple device services (Attendance, User, Face Recognition, etc.)
- ✅ Service provider for automatic package registration
- ✅ Comprehensive exception handling
- ✅ Clean, maintainable architecture
Installation
Install the package via Composer. This package supports both raw PHP and Laravel with the same install.
- If you use this package in a raw PHP project, you do not need Laravel; just use
ZktecoFactory. - If you use this package in a Laravel project, use the same package, and then use Laravel-specific features such as the service provider and facade.
You do not need separate package installations. The same package works for both raw PHP and Laravel.
Raw PHP Usage
Use this package in a raw PHP script without Laravel.
Single Device Configuration
Multiple Device Configuration
Usage
Standalone PHP
Use the factory class to create ZKTeco instances without Laravel:
Laravel
The package automatically registers in Laravel. You can use it in three ways:
1. Using the Facade (Recommended)
2. Using Service Container
3. Using the Factory
Available Services
The package includes the following services:
- Attendance - Manage attendance records
- User - User management and operations
- Face - Face recognition features
- Fingerprint - Fingerprint management
- Device - Device management
- Connect - Device connectivity
- Ping - Device health checks
- Time - Time synchronization
- Os - Operating system info
- Version - Version information
- SerialNumber - Device serial numbers
- Vendor - Vendor information
- Platform - Platform information
- Ssr - SSR operations
- Pin - PIN management
- WorkCode - Work code management
- Util - Utility functions
Public ZKTeco Library Methods
Use these methods on a ZillurWeb\ZktecoPhpSDK\Library\ZKTeco instance.
__construct(string $ip, int $port = 4370, bool $shouldPing = false, int $timeout = 25, $password = 0)- Create a new device client with connection settings.setPing(bool $shouldPing = false, bool $silentPing = true): void- Enable or disable ping checks before connecting.connect(): bool- Open a connection to the ZKTeco device.disconnect(): bool- Close the connection to the device.version()- Read the device firmware version.osVersion()- Read the device operating system version.platform()- Read the device platform details.fmVersion()- Read the firmware module version.workCode()- Get the configured work code data.ssr()- Get the SSR (Self-Service Recorder) status/data.pinWidth()- Read the device PIN width configuration.faceFunctionOn()- Enable face recognition mode on the device.serialNumber()- Read the device serial number.vendorName()- Read the device vendor name.deviceId()- Read the device ID.deviceName()- Read the device name.disableDevice()- Disable the device.enableDevice()- Enable the device.getDeviceData(string $key)- Read a device-specific data field.setCustomData(string $key, $value)- Write custom data to the device.getCustomData(string $key)- Read custom data previously stored on the device.setPushCommKey($value)- Set the push communication key.getPushCommKey()- Get the current push communication key.getUsers(callable $callback = null): array- Fetch all user records from the device.setUser(int $uid, $userid, string $name, $password, int $role = Util::LEVEL_USER, int $cardno = 0)- Add or update a user record.clearAllUsers()- Delete all users from the device.deleteUsers(callable $callback)- Remove users by callback filter.clearAdminPriv()- Clear administrator privileges from current users.removeUser(int $uid)- Remove a single user by UID.getFingerprint(int $uid)- Read fingerprint data for a given UID.setFingerprint(int $uid, array $fingerprint)- Write fingerprint data for a given UID.removeFingerprint($uid, array $data)- Delete fingerprint records for a UID.getAttendance(callable $callback = null): array- Read attendance log records.clearAttendance()- Clear the attendance log on the device.setTime($t)- Set device time.getTime()- Read the current device time.shutdown()- Power off the device.restart()- Restart the device.sleep()- Put the device into sleep mode.resume()- Wake the device from sleep mode.testVoice($index = 0)- Play a voice test sound on the device.clearLCD()- Clear the device LCD display.writeLCD($message = 'Welcome ZkTeco')- Write a message to the LCD display.getMemoryInfo()- Read memory usage information from the device.ping($throw = false)- Ping the device and optionally throw on failure.
Method Usage Examples
These examples show how to use the ZKTeco methods in raw PHP. Start by creating a device instance with ZktecoFactory, then call connect(), use the methods, and finally call disconnect().
Connection and ping
Read device info
Custom device data
User management
Fingerprint operations
Attendance operations
Device control
Feature control and device mode
Clean up
Configuration
For Laravel
Publish the package configuration file:
This creates config/zkteco.php where you can configure device settings:
Update your .env file:
For Standalone PHP
Create a config array and pass it to the factory:
Examples
Get Device Attendance Records
Get User List
Get Fingerprint Data
Device Information
Testing
Run the test suite with:
Generate coverage report:
License
This package is open-sourced software licensed under the MIT license.
Support
For issues, questions, or contributions, please:
- Check the Contributing Guidelines
- Open an issue on GitHub
- Submit a pull request
Changelog
See CHANGELOG.md for release information.