# sunilskc/am05zk architecture

> Architecture diagram of the GitHub repository sunilskc/am05zk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sunilskc/am05zk
- Repository: https://github.com/sunilskc/am05zk

## Overview

am05zk is a small PHP library for communicating with ZKFinger fingerprint and attendance devices. A client creates the library with a device IP, connects, then requests device information, manages users, or reads and clears attendance before disconnecting. Internally, the class frames SDK commands and exchanges socket data with the scanner; user and attendance methods decode returned records, including attendance timestamps. The README notes that SDK versions may differ and that PHP SOAP, Socket, and cURL extensions are required. The excerpt omits some transport setup and command internals, so the graph shows only documented or visible relationships.

Main entry points: [`am05zk.php`](https://github.com/sunilskc/am05zk/blob/master/am05zk.php) (Socket exchange)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Library API"]
  node_library["am05zk library<br/>[am05zk.php]"]
  node_device_info["Device information<br/>[am05zk.php]"]
  node_device_control["Device controls<br/>[am05zk.php]"]
end

subgraph group_protocol["Device Protocol"]
  node_framing["Command framing<br/>[am05zk.php]"]
  node_socket["Socket exchange<br/>[am05zk.php]"]
end

subgraph group_records["Device Records"]
  node_user_records["User records<br/>[am05zk.php]"]
  node_attendance["Attendance records<br/>[am05zk.php]"]
  node_time_decode["Time decoding<br/>[am05zk.php]"]
end

node_client(("PHP client"))
node_device["ZKFinger scanner"]

node_client -->|"creates and calls"| node_library
node_library -->|"builds commands"| node_framing
node_library -->|"exchanges data"| node_socket
node_socket -->|"sends commands"| node_device
node_device -->|"returns replies"| node_socket
node_client -->|"requests details"| node_device_info
node_client -->|"controls device"| node_device_control
node_client -->|"reads users"| node_user_records
node_client -->|"reads or clears"| node_attendance
node_user_records -->|"requests user data"| node_socket
node_attendance -->|"requests records"| node_socket
node_attendance -->|"decodes timestamps"| node_time_decode

click node_library "https://github.com/sunilskc/am05zk/blob/master/am05zk.php"
click node_framing "https://github.com/sunilskc/am05zk/blob/master/am05zk.php"
click node_socket "https://github.com/sunilskc/am05zk/blob/master/am05zk.php"
click node_device_info "https://github.com/sunilskc/am05zk/blob/master/am05zk.php"
click node_device_control "https://github.com/sunilskc/am05zk/blob/master/am05zk.php"
click node_user_records "https://github.com/sunilskc/am05zk/blob/master/am05zk.php"
click node_attendance "https://github.com/sunilskc/am05zk/blob/master/am05zk.php"
click node_time_decode "https://github.com/sunilskc/am05zk/blob/master/am05zk.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_library,node_device_info,node_device_control,node_client toneBlue
class node_framing,node_socket toneAmber
class node_user_records,node_attendance,node_time_decode toneMint
class node_device toneIndigo
```

## Components

### Library API

- [am05zk library](https://github.com/sunilskc/am05zk/blob/master/am05zk.php): `am05zk.php`
- [Device information](https://github.com/sunilskc/am05zk/blob/master/am05zk.php): `am05zk.php`
- [Device controls](https://github.com/sunilskc/am05zk/blob/master/am05zk.php): `am05zk.php`

### Device Protocol

- [Command framing](https://github.com/sunilskc/am05zk/blob/master/am05zk.php): `am05zk.php`
- [Socket exchange](https://github.com/sunilskc/am05zk/blob/master/am05zk.php): `am05zk.php`

### Device Records

- [User records](https://github.com/sunilskc/am05zk/blob/master/am05zk.php): `am05zk.php`
- [Attendance records](https://github.com/sunilskc/am05zk/blob/master/am05zk.php): `am05zk.php`
- [Time decoding](https://github.com/sunilskc/am05zk/blob/master/am05zk.php): `am05zk.php`

### Other components

- **PHP client**
- **ZKFinger scanner**

## Connections

- PHP client → am05zk library: creates and calls (evidence: `README.md`)
- am05zk library → Command framing: builds commands (evidence: `am05zk.php`)
- am05zk library → Socket exchange: exchanges data (evidence: `am05zk.php`)
- Socket exchange → ZKFinger scanner: sends commands (evidence: `am05zk.php`)
- ZKFinger scanner → Socket exchange: returns replies (evidence: `am05zk.php`)
- PHP client → Device information: requests details (evidence: `README.md`)
- PHP client → Device controls: controls device (evidence: `README.md`)
- PHP client → User records: reads users (evidence: `README.md`)
- PHP client → Attendance records: reads or clears (evidence: `README.md`)
- User records → Socket exchange: requests user data (evidence: `am05zk.php`)
- Attendance records → Socket exchange: requests records (evidence: `am05zk.php`)
- Attendance records → Time decoding: decodes timestamps (evidence: `am05zk.php`)
