PHPackages                             sanshin/sanshin-zkteco-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sanshin/sanshin-zkteco-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sanshin/sanshin-zkteco-sdk
==========================

ZKLibrary is PHP Library for ZK Time &amp; Attendance Devices

v1.0.0(1y ago)011MITPHP

Since Oct 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/toannt-sanshin-its/sanshin-zkteco-sdk)[ Packagist](https://packagist.org/packages/sanshin/sanshin-zkteco-sdk)[ RSS](/packages/sanshin-sanshin-zkteco-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

[![Issues](https://camo.githubusercontent.com/fd42b8e37a5e040475047eafdba7967589c926bfacea53a82261f0504f8bd2d9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f53616e7368696e2f7a6b7465636f2d73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/nurkarim/zkteco-sdk-laravel/issues)[![Stars](https://camo.githubusercontent.com/47c8a11eab9a6689576d875051504d8298a308b1300a2f6956e73ce8c7bc917d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f53616e7368696e2f7a6b7465636f2d73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/nurkarim/zkteco-sdk-laravel/stargazers)[![Forks](https://camo.githubusercontent.com/b9996aa0760b61d085c85d3e80588b855574ec0a2e9c720dd766f8bc6f330913/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f53616e7368696e2f7a6b7465636f2d73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/nurkarim/zkteco-sdk-laravel/network/members)

Zkteco Laravel SDK
------------------

[](#zkteco-laravel-sdk)

This package easy to use functions to ZKTeco Device activities with **laravel** framework.

**Requires:** Laravel &gt;= 5.0

**License:** MIT

### About SDK

[](#about-sdk)

**Laravel** ZKLibrary is PHP Library for ZK Time &amp; Attendance Devices. This library is design to reading and writing data to attendance device (fingerprint, face recognition or RFID) using UDP protocol. This library is useful to comunicate between web server and attendance device directly without any addition program. This library is implemented in the form of class. So that you can create an object and use it functions.

Web server must be connected to the attendance device via Local Area Network (LAN). The UDP port that is used in this communication is 4370. You can not change this port without changing firmware of the attendance device. So, you just use it.

The format of the data are: binary, string, and number. The length of the parameter and return value must be vary.

### This package is compatible with Laravel `5.* 6.* 7.* 8.*`

[](#this-package-is-compatible-with-laravel-5-6-7-8)

Installation
------------

[](#installation)

Begin by installing this package through Composer. Just run following command to terminal-

```
composer require sanshin/sanshin-zkteco-sdk

```

Once this operation completes, the final step is to add the service provider. Open config/app.php, and add a new item to the providers array.

```
'providers' => [

        // .........................
        Sanshin\Zkteco\ZktecoServiceProvider::class,

    ]

```

If you want to change Zkteco settings , you need to publish its config file(s). For that you need to set ip address in the terminal-

```
php artisan vendor:publish

```

Usages
======

[](#usages)

##### Create an object of ZktecoLib class.

[](#create-an-object-of-zktecolib-class)

```
    use Sanshin\Zkteco\Http\Library\ZktecoLib;

//  1 s't parameter is string $ip Device IP Address
//  2 nd  parameter is integer $port Default: 4370

    $zk = new ZktecoLib(config('zkteco.ip'));

//  or you can use with port
//    $zk = new ZktecoLib(config('zkteco.ip'), 8080);

```

### ZktecoLib Method

[](#zktecolib-method)

- Connect

    ```
    //    this return bool
          $zk->connect()

    ```
- Disconnect

    ```
     // this is return bool
     $zk->disconnect()

    ```
- Device Enable

    ```
     // this is return bool//mixed
     $zk->deviceEnable()

    ```
- Device Disable

    ```
     // this is return bool//mixed
     $zk->deviceDisable()

    ```
- Face Function On

    ```
     // this is return bool//mixed
     $zk->faceFunctionOn()

    ```
- Device Restart

    ```
     // this is return bool//mixed
     $zk->restart()

    ```
- Device Serial Number

    ```
      //    get device serial number
     $zk->serialNumber()

    ```
- Device Name

    ```
      //    get device name
     $zk->deviceName()

    ```
- Device PIN Width

    ```
      //    get device pin width
     $zk->pinWidth()

    ```
- Device SSR

    ```
      //    get device ssr
     $zk->ssr()

    ```
- Device Work Code

    ```
      //    get device work code
     $zk->workCode()

    ```
- Device Firmware Version

    ```
      //    get device fmVersion
     $zk->fmVersion()

    ```
- Device Platform

    ```
      //    get device platform
     $zk->platform()

    ```
- Get Attendance

    ```
     //    return array[]
     $zk->getAttendance()

    ```
- Clear Attendance

    ```
     //   return bool/mixed
     $zk->clearAttendance()

    ```
- Clear Admin

    ```
     //    remove all admin
     //    return bool|mixed
     $zk->clearAdmin()

    ```
- Clear User

    ```
     //    remove all users
     //    return bool|mixed
     $zk->clearUser()

    ```
- Get User

    ```
      //    get User
      //    this return array[]
      $zk->getUser()

    ```
- Delete User

    ```
      //    parameter integer $uid
      //    return bool|mixed
      $zk->deleteUser()

    ```
- Set/Add User

    ```
      //    1 s't parameter int $uid Unique ID (max 65535)
      //    2 nd parameter int|string $userid ID in DB (same like $uid, max length = 9, only numbers - depends device setting)
      //    3 rd parameter string $name (max length = 24)
      //    4 th parameter int|string $password (max length = 8, only numbers - depends device setting)
      //    5 th parameter int $role Default Util::LEVEL_USER
      //    return bool|mixed
      $zk->setUser()

    ```
- User Role

    ```
      The role of user. The length of $role is 1 byte. Possible value of $role are:

      0 = LEVEL_USER
      2 = LEVEL_ENROLLER
      12 = LEVEL_MANAGER
      14 = LEVEL_SUPERMANAGER

    ```

Example
-------

[](#example)

```
    use Sanshin\Zkteco\Http\Library\ZktecoLib;

    class ZktecoController extends Controller
    {

        public function index()
        {
            $zk = new ZktecoLib(config('zkteco.ip'),config('zkteco.port'));
            if ($zk->connect()){
            $attendance = $zk->getAttendance();
            return view('zkteco::app',compact('attendance'));
            }

        }

        public function addUser()
        {
            $zk = new ZktecoLib(config('zkteco.ip'),config('zkteco.port'));
            if ($zk->connect()){
                $role = 14; //14= super admin, 0=User :: according to ZKtecho Machine
                $users = $zk->getUser();
                $total = end($users);
                $lastId=$total[3]+1;
                $zk->setUser($lastId, '11', 'super', '234', $role);
                return "Add user success";
            }
            else{
                 return "Device not connected";
            }
        }

    }

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

564d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a80c55d58ce04e41fb6a236297c4012cbdc289b6dd7b5a54c94e7d26061da01?d=identicon)[toannt-sanshin-its](/maintainers/toannt-sanshin-its)

---

Top Contributors

[![NguyenToan3107](https://avatars.githubusercontent.com/u/110925112?v=4)](https://github.com/NguyenToan3107 "NguyenToan3107 (3 commits)")

### Embed Badge

![Health badge](/badges/sanshin-sanshin-zkteco-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/sanshin-sanshin-zkteco-sdk/health.svg)](https://phpackages.com/packages/sanshin-sanshin-zkteco-sdk)
```

###  Alternatives

[extcode/cart

Shopping Cart(s) for TYPO3

57119.3k14](/packages/extcode-cart)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
