1. Go to this page and download the library: Download zillur-web/zkteco-php-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/ */
use ZillurWeb\ZktecoPhpSDK\ZktecoFactory;
// Create a new instance
$zkteco = ZktecoFactory::make('192.168.1.201', 4370, false, 25);
// Or with config array
$zkteco = ZktecoFactory::makeFromConfig([
'host' => '192.168.1.201',
'port' => 4370,
'should_ping' => false,
'timeout' => 25,
]);
// Use the various services
$attendance = $zkteco->getAttendance();
$users = $zkteco->getUser();
use ZillurWeb\ZktecoPhpSDK\Facades\Zkteco;
// Create instance
$zkteco = Zkteco::make('192.168.1.201', 4370);
// Use services
$attendance = $zkteco->getAttendance();
// In your controller or service
public function __construct(ZKTeco $zkteco)
{
$this->zkteco = $zkteco;
}
public function getAttendance()
{
return $this->zkteco->getAttendance();
}
use ZillurWeb\ZktecoPhpSDK\ZktecoFactory;
$factory = app('zkteco');
$zkteco = $factory->make('192.168.1.201');
use ZillurWeb\ZktecoPhpSDK\ZktecoFactory;
$zkteco = ZktecoFactory::make('192.168.1.201', 4370, false, 25);
$zkteco->setPing(false); // optional, disable ping before connect
$connected = $zkteco->connect();
if (! $connected) {
echo "Unable to connect to device.";
exit(1);
}
if ($zkteco->ping()) {
echo "Device is reachable." . PHP_EOL;
}