Download the PHP package olorunda/laravel-aiface-websocket without Composer

On this page you can find all versions of the php package olorunda/laravel-aiface-websocket. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-aiface-websocket

Laravel AiFace Biometric WebSocket Server & Device Command SDK

A high-performance, asynchronous pure-PHP RFC 6455 WebSocket / WSS Server and complete Command Interaction SDK for TimyTeco AiFace Biometric Terminals (Visible Light Facial Recognition, Fingerprint, Palm Vein, RFID Card, PIN, QR Code Access Control & Time Attendance).


โšก Architecture Overview

In the TimyTeco AiFace BS communication protocol, the physical biometric device acts as a client that initiates an outbound persistent WebSocket connection to your Laravel server. This enables seamless Wide Area Network (WAN) and cloud deployment across network segments without requiring static public IPs or port forwarding on the device's local network.


๐Ÿš€ Quickstart Installation

1. Register Package in your Laravel Application

In your Laravel project composer.json, add this package:

(If testing locally in the same monorepo/workspace, add as a path repository):

2. Publish Configuration & Run Database Migrations

Daemon Logging Configuration (.env)

Fine-tune or isolate daemon logs to prevent log pollution on high-traffic servers:

3. Start the WebSocket Server Daemon

Output:

To run on a custom port or with TLS/WSS:


๐Ÿ“ฑ Hardware Device Configuration

On your physical AiFace device touchscreen:

  1. Tap [Menu / Settings] โž” Comm. (Communication) โž” Server Settings / Cloud Settings.
  2. Set Protocol Mode: WebSocket (or BS / Cloud Server).
  3. Set Server IP / Domain: Your server IP address (e.g. 192.168.1.100 or cloud.yourdomain.com).
  4. Set Server Port: 7788 (or 433 for WSS).
  5. Set Server Path: /pub/chat (default path).
  6. Save and restart network. The device will immediately connect and send the reg registration handshake.

๐Ÿ’ป Laravel Facade Usage

Interact with any connected device using the AiFace facade:


๐Ÿš€ Realistic Real-World Workflow Example

Below is a complete, production-grade example illustrating how to manage employee lifecycles (enrolling and offboarding users) via a Controller and automatically track attendance punches using Event Listeners.

1. Employee Biometric Controller (Enrolling & Deleting Users)

Create a controller (app/Http/Controllers/BiometricEmployeeController.php):


2. Real-Time Attendance Event Listener

Create an event listener (app/Listeners/HandleBiometricAttendance.php) to automatically process punches when employees clock in or clock out:


3. Registering the Listener in Laravel

In your app/Providers/AppServiceProvider.php (Laravel 11 & 12) or EventServiceProvider.php (Laravel 9 & 10):


๐Ÿ› ๏ธ Complete Command Reference (All 80+ Commands)

Every command defined in the TimyTeco AiFace specification is implemented with typed methods:

1. User Management (17 Commands)

Method Protocol Command Description
setUserInfo($enrollId, $name, ...) setuserinfo Set user profile, card, password, face, fingerprint
setUserFacePhoto($id, $name, $jpg) setuserinfo (50) Quick enroll face image (base64 JPG)
setUserPassword($id, $name, $pwd) setuserinfo (10) Quick enroll PIN/password
setUserCard($id, $name, $card) setuserinfo (11) Quick enroll RFID card number
setUserFingerprint($id, $name, $slot, $hex) setuserinfo (0-9) Quick enroll fingerprint with 0-compression
deleteUser($enrollId, $backupNum = null, $delay = null) deleteuser Delete user immediately or schedule delayed deletion (int seconds or DateTime)
delayedDeleteUser($enrollId, $delay, $backupNum = null) delayeddelete Schedule user/credential deletion after delay elapses (offline resilient)
cancelDelayedDelete($enrollId) canceldelayeddelete Cancel pending delayed deletion for user
getPendingDelayedDeletes() getpendingdelayeddeletes Retrieve list of all scheduled delayed delete tasks
getPendingCommands() getpendingcommands Retrieve all pending queued commands (offline queue & scheduled tasks)
cancelQueuedCommand($taskId) cancelqueuedcommand Cancel any pending queued command by task ID
cleanUser() cleanuser Clear all users from hardware
setUserName(array $users) setusername Batch set user names
getUserName($enrollId) getusername Query user name by ID
getUserList($page, $pageSize) getuserlist Paginated list of user IDs
getUserIds() getuserids Query all enrolled user IDs
getUnusedUserId() getunuserdid Get next available user ID
checkUserId($enrollId) checkuserid Check if user ID exists
getUserInfo($enrollId, $backupNum) getuserinfo Retrieve credential data
getAllUsers($page, $pageSize) getallusers Batch retrieve user data
addUser($enrollId, $backupNum, $admin) adduser Start on-device enrollment wizard
checkRegStatus($enrollId, $backupNum) checkregstatus Check status of enrollment
cancelAddUser($enrollId, $backupNum) canceladduser Cancel on-device enrollment
enableUser($enrollId, $enable) enableuser Enable/disable user account
getUserProfile($enrollId) getuserprofile Get custom profile JSON
setUserProfile($enrollId, $profile) setuserprofile Set custom profile JSON

2. Log Management (4 Commands)

Method Protocol Command Description
getNewLog() getnewlog Fetch unread attendance punch records
getAllLog($page, $pageSize, $start, $end) getalllog Paginated search of attendance records
cleanLog() cleanlog Clear all logs from hardware
cleanLogPhoto() cleanlogphoto Clear snapshot photos from hardware

3. Device Management (15 Commands)

Method Protocol Command Description
getDevInfo() getdevinfo Query hardware parameters
setDevInfo(array $devInfo) setdevinfo Configure volume, timeout, etc.
getDevCap() getdevcap Capacity and usage statistics
getTime() gettime Get device RTC clock
setTime($time) settime Set device clock
syncTime() settime Synchronize with current server time
initsys() initsys Factory reset system
initMenu() initmenu Reset menu configurations
cleanDatabase() cleandatebase Wipe database
cleanAdmin() cleanadmin Demote all administrators to normal users
cleanInactiveUser($days) cleaninactiveuser Delete users inactive for N days
reboot() reboot Reboot device hardware
disableDevice() disabledevice Disable recognition
enableDevice() enabledevice Enable recognition
checkLive() checklive Heartbeat ping from server
getReg() getreg Read registration info

4. Access Control (9 Commands)

Method Protocol Command Description
openDoor($doorNum) opendoor Remote unlock door relay
lockCtrl($ctrl, $doorNum) lockctrl 0=Normal, 1=Always Open, 2=Always Closed
getDoorStatus($doorNum) getdoorstatus Query magnetic door sensor state
setDevLock(array $lockParams) setdevlock Set relay delay, sensor mode, alarm
getDevLock() getdevlock Read access lock parameters
getUserLock($enrollId) getuserlock Get user timezone / door group
setUserLock(array $records) setuserlock Batch set user access permissions
deleteUserLock($enrollId) deleteuserlock Remove user access permissions
cleanUserLock() cleanuserlock Clear all user permissions

5. Attendance Management (6 Commands)

Method Protocol Command Description
getShift($shiftId) getshift Query shift schedule
setShift($shiftId, array $records) setshift Set shift schedule
getBellTime() getbelltime Query bell alarm schedule
setBellTime(array $bells) setbelltime Set bell alarm schedule
setHoliday(array $holidays) setholiday Set holiday dates
getHoliday() getholiday Query holiday dates

6. File Management (3 Commands)

Method Protocol Command Description
getDir($path) getdir List files in device directory
getFile($filename, $index, $count) getfile Download file from device (base64)
writeFile($filename, $base64, ...) writefile Upload file to device (base64)

7. Other System Commands (15 Commands)

Method Protocol Command Description
upgrade($url, $md5) upgrade Firmware upgrade from server URL
forceOta() forceota Force immediate OTA check
setOtaServer($url) setotaserver Configure OTA update endpoint
getOtaServer() getotaserver Query OTA update endpoint
setScreensaver($base64Data) setscreensaver Set screensaver image/video
setVoice($index, $base64Audio) setvoice Set custom voice audio prompts
keypad($show) keypad Control on-screen keypad
verify($enrollId, $mode) verify Remote biometric verification
setDepartment(array $departments) setdepartment Configure department list
getDepartment() getdepartment Query department list
setCompanyName($name) setcompanyname Set company title on screen
getCompanyName() getcompanyname Query company title
setQuestionnaire(array $questions) setquestionnaire Configure survey questions
getQuestionnaire() getquestionnaire Query questionnaires
cleanQuestionnaire() cleanquestionnaire Clear questionnaires

8. Video Intercom Commands (11 Commands)

Method Protocol Command Description
enableWebRtc(...) enablewebrtc Configure WebRTC, STUN, and TURN
callAccept($sessionId, $accept) callaccept Accept or reject video call
viewReady($sessionId) viewready Signal ready for stream
answer($sessionId, $sdp) answer Send WebRTC answer SDP
iceCandidate($sessionId, ...) icecandidate Send ICE candidate
callCancel($sessionId) callcancel Terminate video call
talkLock($sessionId, $doorNum) talklock Unlock door during active call
monitorCall($sessionId) monitorcall Start video monitoring
setViSelection(array $selections) setviselection Set visual selection menu

๐ŸŒ HTTP REST API & Webhooks

REST Endpoints

๐Ÿ›ก๏ธ Automatic Offline Command Queueing & Auto-Flush on Reconnect

In real-world deployments, biometric devices may temporarily lose Wi-Fi or go offline during maintenance. Rather than displaying errors or timing out waiting for a device response:

The server automatically intercepts offline or unresponsive states and queues the command:

  1. Persistent Backing: Commands are persisted in memory and in the aiface_scheduled_commands database table. If the server daemon restarts, pending commands are recovered automatically.
  2. Auto-Flush Upon Reconnect: The instant the physical device connects and registers with the WebSocket daemon (cmd: reg), the daemon flushes and dispatches all pending queued commands in FIFO order!
  3. Event & Webhook: Fires the CommandQueued event (command.queued webhook).

Import postman_collection.json into Postman for ready-to-use requests.

Webhook & Laravel Event Listeners

The package routes all hardware events through Laravel's standard Event Dispatcher and a dedicated event listener (DispatchAiFaceWebhook):

1. Listening to Clock-In & Biometric Events in Laravel

You can attach listeners or subscribers in your own application:

2. External Webhook Event Forwarding

Configure external HTTP webhook endpoints in config/aiface.php:

Incoming webhook requests include HMAC SHA-256 signatures for tamper verification:


๐Ÿงช Testing with Mock Device Simulator

Run the included pure-PHP mock terminal simulator to test end-to-end communication without physical hardware:

The mock device maintains its own local SQLite database (tynyteko_{SN}.sqlite) simulating real hardware storage:

Run the test suite:


๐Ÿ“œ License

MIT License.


All versions of laravel-aiface-websocket with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/events Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^9.0|^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package olorunda/laravel-aiface-websocket contains the following files

Loading the files please wait ...