Download the PHP package 0mithun/php-zkteco without Composer

On this page you can find all versions of the php package 0mithun/php-zkteco. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-zkteco

Latest Stable Version Total Downloads License

PHP ZKTeco

A PHP library for interfacing with ZKTeco biometric attendance devices. Supports both TCP and UDP protocols for reliable communication with fingerprint attendance machines.

Features

Requirements

Installation

Quick Start

TCPMUX HTTP CONNECT Proxy

Connect through a TCPMUX httpconnect multiplexer for subdomain-based routing. This allows multiple devices to share a single port, routed by subdomain.

Basic TCPMUX Usage

How TCPMUX Works

  1. Library connects to proxy server at base_domain:tcpmux_port
  2. Sends HTTP CONNECT request with target subdomain.base_domain:device_port
  3. Proxy routes the connection to the device based on subdomain
  4. After tunnel is established, ZKTeco protocol communicates through it

Connection Comparison

Feature Direct TCP/UDP TCPMUX
Port per device Required (e.g., 7001, 7002...) Shared (e.g., 1337)
Routing By port number By subdomain
Scalability Limited by ports Unlimited subdomains

Constructor Parameters


API Reference

Connection Methods

connect(): bool

Establishes connection to the ZKTeco device.

disconnect(): bool

Disconnects from the device.

ping(bool $throw = false): bool

Tests connectivity to the device.


Device Information Methods

vendorName(): string|false

Returns the device manufacturer name.

deviceName(): string|false

Returns the device model name.

deviceId(): string|false

Returns the device ID.

serialNumber(): string|false

Returns the device serial number.

version(): string|false

Returns the firmware version.

osVersion(): string|false

Returns the OS version.

platform(): string|false

Returns the platform information.

fmVersion(): string|false

Returns the firmware version number.

pinWidth(): string|false

Returns the PIN width setting.

workCode(): string|false

Returns the work code status.

ssr(): string|false

Returns the SSR (Self-Service Recorder) status.

faceFunctionOn(): string|false

Returns whether face recognition is enabled.

getMemoryInfo(): object|false

Returns device memory information.


Time Methods

getTime(): string|false

Returns the current device time.

setTime(string $time): bool

Sets the device time.


User Management Methods

getUsers(?callable $callback = null): array

Retrieves all registered users from the device.

setUser(int $uid, string|int $userid, string $name, string|int $password, int $role = 0, int $cardno = 0): bool

Adds or updates a user on the device.

Parameters:

removeUser(int $uid): bool

Removes a user by UID.

deleteUsers(callable $callback): void

Removes users conditionally using a callback.

clearAllUsers(): bool

⚠️ Warning: Removes ALL users from the device.

clearAdminPriv(): bool

Removes admin privileges from all users.


Attendance Methods

getAttendances(?callable $callback = null): array

Retrieves attendance records from the device.

Attendance States:

clearAttendance(): bool

⚠️ Warning: Clears ALL attendance logs from the device.

getRealTimeLogs(callable $callback, int $timeout = 0): bool

🆕 Registers for real-time attendance events. When a user scans their fingerprint or enters credentials, the callback is called immediately with the log data.

Parameters:

Note: This method blocks while listening for events. Use the $timeout parameter or run in a background process/worker.

getRealTimeEvents(callable $callback, int $events, int $timeout = 0): bool

🆕 v1.2.0 Registers for multiple real-time event types. This is a more comprehensive version of getRealTimeLogs() that supports all device events.

Supported Events (use Mithun\PhpZkteco\Libs\Services\Util constants):

Constant Value Description
EF_ATTLOG 1 Attendance log (user punch in/out)
EF_FINGER 2 Fingerprint scanned
EF_ENROLLUSER 4 User enrolled on device
EF_ENROLLFINGER 8 Fingerprint enrolled
EF_BUTTON 16 Button pressed on device
EF_UNLOCK 32 Door unlocked
EF_VERIFY 128 User verified
EF_FPFTR 256 Fingerprint feature event
EF_ALARM 512 Alarm triggered

Parameters:

Event Data Structure:

All events include these base fields:

Plus event-specific fields:

Event Additional Fields
EF_ATTLOG user_id, record_time, state
EF_ENROLLUSER / EF_VERIFY user_id
EF_FINGER / EF_ENROLLFINGER / EF_FPFTR user_id, finger_index
EF_BUTTON button_id
EF_UNLOCK door_id, unlock_type
EF_ALARM alarm_type

Fingerprint Methods

getFingerprint(int $uid): array|false

Retrieves fingerprint data for a user.

setFingerprint(int $uid, array $fingerprint): bool

Sets fingerprint data for a user.

removeFingerprint(int $uid, array $fingerIds): int

Removes specific fingerprints from a user.


Device Control Methods

disableDevice(): bool

Disables the device (prevents user interaction).

enableDevice(): bool

Re-enables the device.

shutdown(): bool

Powers off the device.

restart(): bool

Restarts the device.

sleep(): bool

Puts the device into sleep mode.

resume(): bool

Wakes the device from sleep mode.


Display & Audio Methods

writeLCD(string $message = 'Welcome ZkTeco'): bool

Displays a message on the device LCD screen.

clearLCD(): bool

Clears the LCD screen.

testVoice(int $index = 0): bool

Plays a voice prompt on the device.


Custom Data Methods

getDeviceData(string $key): string

Retrieves device configuration data.

setCustomData(string $key, mixed $value): bool

Sets custom data on the device.

getCustomData(string $key): string

Retrieves custom data from the device.

setPushCommKey(string $value): bool

Sets the push communication key (for iClock integration).

getPushCommKey(): string

Gets the push communication key.


Protocol Comparison

Feature TCP UDP
Reliability High Medium
Speed Slightly slower Fast
Connection Persistent Connectionless
Large data transfer Better May have issues
Recommended for Production Local testing

Error Handling

Laravel Usage

The package auto-registers its service provider. You can use it in your controllers or commands:

Debugging

Enable debug logging by defining constants before instantiation:

Contributing

Please see CONTRIBUTING for details.

Security

If you've found a security vulnerability, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of php-zkteco with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package 0mithun/php-zkteco contains the following files

Loading the files please wait ...