Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3bc98ad
Adjustemnts to readme
wnasich Jun 28, 2017
ddf1ce0
Tweaking readme
wnasich Jun 28, 2017
c32c900
Adjustemnts for model ZEM500
wnasich Jun 28, 2017
77ed473
Removing TIME_OFFSSET. Using documented time format.
wnasich Jun 28, 2017
d230320
Removing not needed method
wnasich Jun 28, 2017
c8ac474
Removing unuseful try/catch blocks
wnasich Jun 28, 2017
317f030
Adding twitter bootstrap to zktest page
wnasich Jun 28, 2017
dee2963
Spaces to tabs
wnasich Jun 28, 2017
e18d6e4
Adding user timezone to data structure
wnasich Jun 28, 2017
1c4a763
Displaying user timezone in test page
wnasich Jun 28, 2017
2f0d0e8
Using proper namespace on top
wnasich Jun 28, 2017
81d40f2
Adding command to test voice
wnasich Jun 28, 2017
499e6f4
Arranging code
wnasich Jun 28, 2017
48a4ddc
Reading blocks of 1032 bytes
wnasich Jul 1, 2017
2a39f45
Fixing unpack of attendance data stream
wnasich Jul 2, 2017
9ac1882
Adding methods to extract validation of attendance and wether it is a…
wnasich Jul 2, 2017
588444f
Displaying validation and attendance in/out
wnasich Jul 2, 2017
897cb3d
Throw an exception when socket communication has an error
wnasich Jul 2, 2017
cd65376
Updating supported model
wnasich Jul 2, 2017
acbf2b8
Adding composer.json
wnasich Jul 5, 2017
4c0a260
Fixing composer.json
wnasich Jul 5, 2017
7851e14
Updating composer.json
wnasich Jul 5, 2017
345188a
Adding method for delete a user
wnasich Jul 5, 2017
9724754
Adding methods for show message on display and clear display.
wnasich Jul 5, 2017
7cd2be3
Adding method to enable clock on LCD
wnasich Jul 5, 2017
0098cc2
Renaming constant to honor documentation
wnasich Jul 5, 2017
c861abc
Adding .gitignore
wnasich Jul 7, 2017
3a7bddc
Spec autoload entry on composer.json
wnasich Jul 7, 2017
0482faa
Moving files to new folder src/
wnasich Jul 7, 2017
271df21
Moving under namespace ZKLib. Tweaking code.
wnasich Jul 7, 2017
f2fc45e
Updating zktest.php
wnasich Jul 7, 2017
2cadb44
Adding Install and Test section to README
wnasich Jul 7, 2017
91151a4
Moving under namespace ZKLib. Tweaking code.
wnasich Jul 7, 2017
1fb6015
Fix proper access of RuntimeException class
wnasich Jul 7, 2017
ca00155
Renaming method to getUsers()
wnasich Jul 7, 2017
1f89591
Decoding role on ZKLib class
wnasich Jul 7, 2017
fd1caa1
Fixing access to class constants
wnasich Jul 7, 2017
75a073a
Renaming methods
wnasich Jul 11, 2017
4564252
Renaming constants of Attendance
wnasich Jul 11, 2017
4ac9841
Tweaking layout of test page
wnasich Jul 12, 2017
607a3dd
Fixing extract of data from udp stream
wnasich Jul 13, 2017
8872391
Renaming method to getAdminsStored()
wnasich Jul 13, 2017
573cc29
Displaying clock capacities on test page
wnasich Jul 13, 2017
f53b25d
Updating README with tested models
wnasich Aug 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
composer.lock
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# PHP ZKLib

Attendance Machine Library for PHP with a connection to the network using the UDP protocol and port 4370
PHP library for communication with ZKTeco Attendance Machine

## Donate bitcoin
Adjustemnts for platform ZEM500.

![Donate](https://blockr.io/api/v1/address/Qr/1BTsPJFMwSiiQnTusDXUF9YA8Hrm1NLQTD)
Tested on models SBTS H0201, ZK F707.

1BTsPJFMwSiiQnTusDXUF9YA8Hrm1NLQTD
## Install

```
composer require wnasich/php_zklib
```

## Test connection to your device
Edit file zktest.php and update the line `$zk = new ZKLib('192.168.1.201');` with your device ip address.


### Donations
```
Bitcoin : 187w4iNVHX44y2PC96AuhP286aUKNjcrXV
Litecoin: LVutsPn9jaoC6SScdxsGMM2uAMvPbjNZXq
PIVX : D81ZZt8jAvWQFaLhtx3f4ntstUCCYBcdne
```
48 changes: 0 additions & 48 deletions ZKLib/Attendance.php

This file was deleted.

78 changes: 0 additions & 78 deletions ZKLib/Capacity.php

This file was deleted.

60 changes: 0 additions & 60 deletions ZKLib/User.php

This file was deleted.

14 changes: 14 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "wnasich/php_zklib",
"description": "PHP library for communication with ZKTeco Attendance Machine",
"keywords": ["time-attendance", "zkteco", "SBTS H0201"],
"homepage": "http://github.com/wnasich/php_zklib",
"type": "library",
"license": "MIT",
"require": {
"php": ">=5.3.3"
},
"autoload": {
"psr-4": {"ZKLib\\": "src/"}
}
}
48 changes: 48 additions & 0 deletions src/Attendance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
namespace ZKLib;

use \DateTime;

class Attendance {
const VALIDATED_BY_PASSWORD = 'password';
const VALIDATED_BY_FINGERPRINT = 'fingerprint';

private $userId;
private $type;
private $status;
private $time;

public function getType(){
return $this->type;
}

public function getUserId(){
return $this->userId;
}

public function getStatus(){
return $this->status;
}

public function isOut(){
return ($this->type & 0x20) > 0;
}

public function validatedBy(){
return ($this->type & 0x08) ? static::VALIDATED_BY_FINGERPRINT : static::VALIDATED_BY_PASSWORD;
}

/**
* @return \DateTime
*/
public function getDateTime(){
return $this->time;
}

public function __construct($userId, DateTime $dateTime, $type, $status){
$this->userId = $userId;
$this->time = $dateTime;
$this->type = $type;
$this->status = $status;
}
}
70 changes: 70 additions & 0 deletions src/Capacity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
namespace ZKLib;

class Capacity {
private $att_logs_available;
private $att_logs_capacity;
private $att_logs_stored;
private $templates_available;
private $templates_capacity;
private $templates_stored;
private $users_stored;
private $users_available;
private $users_capacity;
private $admins_stored;
private $passwords_stored;

public function getAttLogsAvailable(){
return $this->att_logs_available;
}

public function getAttLogsCapacity(){
return $this->att_logs_capacity;
}

public function getAttLogsStored(){
return $this->att_logs_stored;
}

public function getTemplatesAvailable(){
return $this->templates_available;
}

public function getTemplatesCapacity(){
return $this->templates_capacity;
}

public function getTemplatesStored(){
return $this->templates_stored;
}

public function getUsersAvailable(){
return $this->users_available;
}

public function getUsersCapacity(){
return $this->users_capacity;
}

public function getUsersStored(){
return $this->users_stored;
}

public function getAdminsStored(){
return $this->admins_stored;
}

public function getPasswordsStored(){
return $this->passwords_stored;
}

public function __construct($data){
foreach ($data as $key => $value){
if (property_exists($this, $key)){
$this->{$key} = $value;
} else {
var_dump($key);
}
}
}
}
Loading