PHP code example of technophilic / zkteco-laravel-sdk

1. Go to this page and download the library: Download technophilic/zkteco-laravel-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

technophilic / zkteco-laravel-sdk example snippets


    ZKTECO_IP = Your Device IP

    ZKTECO_PORT = Device Port (default: 4370)

    use Technophilic\ZKTecoLaravelSDK\ZKTeco;
  
    $zk = new ZKTeco();

    $zk->connect();   // returns bool

    $zk->disconnect();   // returns bool

    $zk->version(); 

    $zk->osVersion(); 

    $zk->shutdown(); 

    $zk->restart(); 

    $zk->sleep(); 

    $zk->resume(); 

    $zk->testVoice(); 

    $zk->platform(); 

    $zk->serialNumber(); 

    $zk->deviceName(); 

    $zk->getTime(); 
    
    // returns bool/mixed bool|mixed Format: "Y-m-d H:i:s"

    $zk->setTime(); 

    // parameter string $t Format: "Y-m-d H:i:s"

    $zk->getUser(); 

    $zk->setUser(); 

    //    set 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
    //    6 th parameter int $cardno Default 0 (max length = 10, only numbers

    //    returns bool|mixed

    $zk->clearAdmin(); 

    $zk->clearAdmin(); 

    $zk->removeUser($uid); 

    //  remove a user by $uid
    //  parameter integer $uid
    //  return bool|mixed


    $zk->getAttendance();   // returns array[]

    $zk->clearAttendance(); 
 bash
php artisan zkteco:install