PHP code example of rajakannan / biosync

1. Go to this page and download the library: Download rajakannan/biosync 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/ */

    

rajakannan / biosync example snippets




iosync\Biosync;

class Attendance {

    protected $ip;
    protected $device;
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        // set your essl attendance machine's IP here
        $this->ip = '192.168.1.7';
    }

    public function index()
    {
        $attendance = $this->getAttendance();
        var_dump($attendance);
    }

    public function connect()
    {
        $this->device = new Biosync($this->ip, 4370);
        $ret = $this->device->connect();
        $this->device->disableDevice();
    }

    public function disconnect()
    {
        $this->device->enableDevice();
        $this->device->disconnect();
    }

    public function getAttendance()
    {
        $this->connect();
        $attendance = $this->device->getAttendance();
        $this->disconnect();
        return $attendance;
    }
}