<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mohamed kamel</title>
    <description>The latest articles on DEV Community by mohamed kamel (@mohamed_kamel_3e7f158103e).</description>
    <link>https://dev.to/mohamed_kamel_3e7f158103e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3054736%2F06c264a8-e19d-4877-87f8-53c8a061d113.png</url>
      <title>DEV Community: mohamed kamel</title>
      <link>https://dev.to/mohamed_kamel_3e7f158103e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohamed_kamel_3e7f158103e"/>
    <language>en</language>
    <item>
      <title>My Experience Successfully Integrating ZKTeco Attendance Device with Laravel</title>
      <dc:creator>mohamed kamel</dc:creator>
      <pubDate>Wed, 16 Apr 2025 07:55:37 +0000</pubDate>
      <link>https://dev.to/mohamed_kamel_3e7f158103e/my-experience-successfully-integrating-zkteco-attendance-device-with-laravel-5550</link>
      <guid>https://dev.to/mohamed_kamel_3e7f158103e/my-experience-successfully-integrating-zkteco-attendance-device-with-laravel-5550</guid>
      <description>&lt;p&gt;In attendance management system projects, one of the biggest challenges was reliably and stably integrating a fingerprint device with a PHP Laravel-based system.&lt;/p&gt;

&lt;p&gt;I tried libraries… I got tired. Looked into SDKs… gave up.&lt;br&gt;
But in the end…&lt;br&gt;
I found the solution! I'm sharing my full experience below 👇&lt;/p&gt;

&lt;p&gt;The Challenge: Issues with Traditional Libraries&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
I used the library mehedijaman/laravel-zkteco, but it failed when connecting externally (on a VPS).&lt;br&gt;
&lt;a href="https://github.com/mehedijaman/laravel-zkteco" rel="noopener noreferrer"&gt;https://github.com/mehedijaman/laravel-zkteco&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
The device operates on a local network (192.101.x.x), while the system is hosted on a remote server.&lt;/p&gt;

&lt;p&gt;ZKTeco SDK tools (work only locally)&lt;/p&gt;

&lt;p&gt;Solutions that rely on UDP/Port 4370&lt;/p&gt;

&lt;p&gt;All of them work locally (localhost), but they:&lt;/p&gt;

&lt;p&gt;Don't work on external hosting (WHM/VPS)&lt;/p&gt;

&lt;p&gt;Don’t support some ZKTeco models&lt;/p&gt;

&lt;p&gt;Require apps to always run on the same network&lt;/p&gt;

&lt;p&gt;The Best &amp;amp; Most Reliable Solution:&lt;br&gt;
ZKBioTime + Port Forwarding + Laravel API Integration&lt;/p&gt;

&lt;p&gt;After deep research, I discovered the only trusted solution 🔐 is using ZKBioTime API by ZKTeco.&lt;/p&gt;

&lt;p&gt;Device Used and Connectivity Method:&lt;/p&gt;

&lt;p&gt;I used the ZKTeco SpeedFace V5L, an advanced device that supports both facial recognition and fingerprint scanning.&lt;/p&gt;

&lt;p&gt;Connected via Wi-Fi:&lt;br&gt;
Instead of connecting the device using a LAN cable, I opted for a wireless connection to reduce wiring and simplify the infrastructure.&lt;/p&gt;

&lt;p&gt;I made sure that:&lt;/p&gt;

&lt;p&gt;The device is connected to the same Wi-Fi network as the local server&lt;/p&gt;

&lt;p&gt;The device IP is static so it doesn’t change on every reboot&lt;/p&gt;

&lt;p&gt;The Cloud Server settings on the device are configured to send data&lt;/p&gt;

&lt;p&gt;Important Note:&lt;br&gt;
Even though the device is on Wi-Fi, it must be in the same network as ZKBioTime. Otherwise, synchronization will fail.&lt;/p&gt;

&lt;p&gt;Steps for Successful Integration:&lt;/p&gt;

&lt;p&gt;1️⃣ Install mehedijaman/laravel-zkteco library in Laravel&lt;br&gt;
2️⃣ Update connection config:&lt;br&gt;
Located at: config/zkteco.php&lt;/p&gt;

&lt;p&gt;3️⃣ Install the official ZKBioTime software on a local server in the same network&lt;br&gt;
4️⃣ Assign a Static IP to the ZKTeco device&lt;br&gt;
5️⃣ Update ZKTeco Cloud Server Settings:&lt;br&gt;
Server Address = 00.000.00. (Your Laravel server IP)&lt;br&gt;
Port = 4370&lt;/p&gt;

&lt;p&gt;6️⃣ Enable Port Forwarding on your router:&lt;br&gt;
Forward port 4370 to the device's local IP 00.000.00&lt;/p&gt;

&lt;p&gt;7️⃣ Open the port in the firewall using iptables + firewalld on the server&lt;/p&gt;

&lt;p&gt;8️⃣ Connect ZKBioTime with the device and make sure the logs appear live&lt;/p&gt;

&lt;p&gt;9️⃣ Test ZKBioTime API using Laravel&lt;/p&gt;

&lt;p&gt;Handling Attendance Data:&lt;/p&gt;

&lt;p&gt;ZKBioTime doesn’t send "in" or "out" flags — it only sends punch timestamps.&lt;/p&gt;

&lt;p&gt;So I developed custom logic inside Laravel:&lt;/p&gt;

&lt;p&gt;First punch of the day = “Clock In”&lt;/p&gt;

&lt;p&gt;Last punch before shift end = “Clock Out”&lt;/p&gt;

&lt;p&gt;With validation of time and employee status&lt;/p&gt;

&lt;p&gt;Smart Syncing (e.g. Every 10 Minutes):&lt;/p&gt;

&lt;p&gt;I created a Scheduled Job in Laravel&lt;/p&gt;

&lt;p&gt;It fetches punches from /iclock/api/transactions/&lt;br&gt;
(Path: App\Console\Kernel.php)&lt;/p&gt;

&lt;p&gt;Stores them in the attendances table with logic to identify Clock In/Out&lt;/p&gt;

&lt;p&gt;Then I activated a Cron Job on the server&lt;/p&gt;

&lt;p&gt;Every 10 minutes, attendance data updates automatically ✅&lt;/p&gt;

&lt;p&gt;Frequently Asked Questions:&lt;/p&gt;

&lt;p&gt;Does the device need Internet?&lt;br&gt;
Yes, and it must be on the same network as ZKBioTime.&lt;/p&gt;

&lt;p&gt;Does this work with all ZKTeco models?&lt;br&gt;
Yes, as long as ZKBioTime supports the device, Laravel just reads from the API.&lt;/p&gt;

&lt;p&gt;Is ZKBioTime considered middleware?&lt;br&gt;
Yes — it's an official API gateway that lets you communicate with the device without SDKs or USB connections.&lt;/p&gt;

&lt;p&gt;Can the router change the IP?&lt;br&gt;
Yes — use a Static IP and check DHCP Lease settings.&lt;/p&gt;

&lt;p&gt;Can this work with a remote server?&lt;br&gt;
Yes — via Port Forwarding and open ports.&lt;/p&gt;

&lt;p&gt;Do I need an internal/local server?&lt;br&gt;
Yes — to install ZKBioTime, which must be on the same network as the device.&lt;/p&gt;

&lt;p&gt;The Final Result:&lt;/p&gt;

&lt;p&gt;✅ A fully working, stable attendance system&lt;br&gt;
🔁 Auto-sync every 10 minutes&lt;br&gt;
🕒 Accurate clock-in and clock-out times&lt;br&gt;
📊 Real-time &amp;amp; accurate data&lt;br&gt;
📅 100% integrated with shifts, leaves, and reporting&lt;/p&gt;

&lt;p&gt;If you're a developer or business owner facing the same challenge — this setup is the solution.&lt;br&gt;
And if you need help integrating your device, DM me or drop a comment ✌️&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
