Giter Club home page Giter Club logo

zkteco's Introduction

ZKTeco - Laravel Library

Issues Forks Stars Total Downloads License

The rats/zkteco package provides easy to use functions to ZKTeco Device activities.

Requires: Laravel >= 6.0

License: MIT or later

Installation:

You can install the package via composer:

composer require rats/zkteco

The package will automatically register itself.

You have to enable your php socket if it is not enable.

Usage

  1. Create a object of ZKTeco class.
    use Rats\Zkteco\Lib\ZKTeco;

//  1 s't parameter is string $ip Device IP Address
//  2 nd  parameter is integer $port Default: 4370
  
    $zk = new ZKTeco('192.168.1.201');
    
//  or you can use with port
//    $zk = new ZKTeco('192.168.1.201', 8080);
    
  1. Call ZKTeco methods
  • Connect
//    connect
//    this return bool
    $zk->connect();   
  • Disconnect
//    disconnect
//    this return bool

    $zk->disconnect();   
  • Enable Device
//    enable
//    this return bool/mixed

    $zk->enableDevice();   

NOTE: You have to call after read/write any info of Device.

  • Disable Device
//    disable 
//    this return bool/mixed

    $zk->disableDevice(); 

NOTE: You have to call before read/write any info of Device.

  • Device Version
//    get device version 
//    this return bool/mixed

    $zk->version(); 
  • Device Os Version
//    get device os version 
//    this return bool/mixed

    $zk->osVersion(); 
  • Power Off
//    turn off the device 
//    this return bool/mixed

    $zk->shutdown(); 
  • Restart
//    restart the device 
//    this return bool/mixed

    $zk->restart(); 
  • Sleep
//    sleep the device 
//    this return bool/mixed

    $zk->sleep(); 
  • Resume
//    resume the device from sleep 
//    this return bool/mixed

    $zk->resume(); 
  • Voice Test
//    voice test of the device "Thank you" 
//    this return bool/mixed

    $zk->testVoice(); 
  • Platform
//    get platform 
//    this return bool/mixed

    $zk->platform(); 
  • Firmware Version
//    get firmware version
//    this return bool/mixed

    $zk->fmVersion(); 
  • Work Code
//    get work code
//    this return bool/mixed

    $zk->workCode(); 
  • SSR
//    get SSR
//    this return bool/mixed

    $zk->ssr(); 
  • Pin Width
//    get  Pin Width
//    this return bool/mixed

    $zk->pinWidth(); 
  • Serial Number
//    get device serial number
//    this return bool/mixed

    $zk->serialNumber(); 
  • Device Name
//    get device name
//    this return bool/mixed

    $zk->deviceName(); 
  • Get Device Time
//    get device time

//    return bool/mixed bool|mixed Format: "Y-m-d H:i:s"

    $zk->getTime(); 
  • Set Device Time
//    set device time
//    parameter string $t Format: "Y-m-d H:i:s"
//    return bool/mixed

    $zk->setTime(); 
  • Get Users
//    get User
//    this return array[]

    $zk->getUser(); 
  • Set Users
//    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

//    return bool|mixed

    $zk->setUser(); 
  • Clear All Admin
//    remove all admin
//    return bool|mixed

    $zk->clearAdmin(); 
  • Clear All Users
//    remove all users
//    return bool|mixed

    $zk->clearAdmin(); 
  • Remove A User
//    remove a user by $uid
//    parameter integer $uid
//    return bool|mixed

    $zk->removeUser(); 
  • Get Attendance Log
//    get attendance log

//    return array[]

//    like as 0 => array:5 [▼
//              "uid" => 1      /* serial number of the attendance */
//              "id" => "1"     /* user id of the application */
//              "state" => 1    /* the authentication type, 1 for Fingerprint, 4 for RF Card etc */
//              "timestamp" => "2020-05-27 21:21:06" /* time of attendance */
//              "type" => 255   /* attendance type, like check-in, check-out, overtime-in, overtime-out, break-in & break-out etc. if attendance type is none of them, it gives  255. */
//              ]

    $zk->getAttendance(); 
  • Clear Attendance Log
//    clear attendance log

//    return bool/mixed

    $zk->clearAttendance(); 

end

zkteco's People

Contributors

itsrafsanjani avatar raihanafroz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zkteco's Issues

How to connect a ZKTeco device which is protected by Communication Password

Hi,

I am facing an issue that my client have an attendance device ZKTeco K50 which is protected by communication password. When I send request for connecting with device it connects but after that I am unable to get data from device and send data to device due to communication password protection.

Please answer.

setFingerprint not working

$zk->setFingerprint(10, $user); not working
i try to getFingerprint for exist one and set to new another one put this function didn't work

Can't insert to ZKTeco

foreach($arrdiff as $diff) {
$z->setUser($diff['uid'], $diff['userid'], $diff['name'], $diff['password'], 0, $diff['cardno']);
}

Filter of attendence and user datas

I cant add filter like (pagination , today attendances) in getAttendance and getUser function. It takes lot of time to get fetch thousands of data from server

can't connect after hosting

I can't connect to my finger print machine after upload to hosting, but the script works perfect on local. i tried different hosting and gives the same result

Clarification

Hello,I am using your library and it is working perfectly fine.I am however confused at some point.Say I pull all access logs from a device.I get back an array.Now this is an example element of the array I am getting back.

0 => array:5 [▼
"uid" => 1
"id" => "1"
"state" => 1
"timestamp" => "2020-05-27 21:21:06"
"type" => 255
]

What do the 'state' and 'type' fields indicate?From my little analysis,I guessed that the state indicates the authentication type.I.e 4-RF Card and 1-Fingerprint.Please clarify.Thanks in advance

get attendance Logs

the zkteco biometric cannot get old biometric logs on old model of zkteco

suggestion... setDateRange()

can you add setDateRange() so that i can set the date of the attendance i want to get?

like this one we use this in java..

CMD=QUERY&TABLE=ATTLOG&STIME=2021-08-18T00:00:01&ETIME=2021-08-18T23:59:59

thanks

SetFingerPrint issue

i have store finger in binary data on database then i want to update same other zkteco device, its notworking.

Maximum execution time of 60 seconds exceeded

So I've installed the library in my Laravel project and also have a K40 device.
I want to test the device connection with the library ( I used the $zk->connect () method, but it won't output anything, rather it would only slow down and finally return the error "Maximum execution time of 60 seconds exceeded".

Pls anyone who knows this fix should help 🥺

Enabel and Disable Device

hello everybody i have this issue with enable and disable Device ether they are not working or i don't know there usage but whenever i tried to disable Device the Device is still accepting Attendance from the User and i believe that it should not do that ill be great full if anybody can provide me with an answer

setTime()

Hi there, I couldn't update the time using the setTime() function, until I commented the "die($t)" on the Time.php class.

`static public function set(ZKTeco $self, $t)
{
// die($t);
$self->_section = METHOD;

    $command = Util::CMD_SET_TIME;
    $command_string = pack('I', Util::encodeTime($t));

    return $self->_command($command, $command_string);
}`

how to get name with id

is it possible to set username in attendence devices and get name using laravel.
currently no username options found.

unpack(): Type H: not enough input, need 1, have 0

I want to greet you and congratulate you for this libery and for the great contribution to the community, I hope that you and your whole family are doing well and that success follows you. I politely request your help, when starting the tests it worked very well, but over time the following error is displayed:

[2022-10-29 11:51:01] production.ERROR: array (
'Archivo: ' => 'C:\xampp\htdocs\project\vendor\rats\zkteco\src\Lib\ZKTeco.php',
'Linea: ' => 63,
'Codigo: ' => 0,
'Mensaje: ' => 'unpack(): Type H: not enough input, need 1, have 0',

Your help, with this particular and I am ready to give you all my help or possibly I am wrong about something.

As a background, I can tell you that I have it deployed in XAMPP and that I am using PHP 7.4 as the Windows 10 operating system and previously I had it in Linux Ubuntu 20 where it kept the same error.

Stay tuned.

God bless us and prosper the fruit of our work, always.

How can I connect to the device through static IP?

The story is like this We want to connect to the device through a cloud server and through the Internet with a static IP, but I encounter this message :
unpack(): Type H: not enough input, need 1, have 0

All port forwarding settings on the router have been done and tested, and the connection with the device is exactly correct (tested).
But the problem is that I cannot connect to the device through this package
In addition, the socket extension is also active in php
please help me
Thanks

Not connecting inBIO 260

Hello everyone!
My device working ZKBioAccess
The device is connected on network and the ping work perfectly
but Not connecting in php ZKLib

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.