Skip to content

Method Reference

All signatures below are taken directly from the source (src/). Optional parameters show their default value.

BioTime

namespace BioTime;

MethodSignatureReturns
__construct__construct(?Config $config = null, ?ClientInterface $httpClient = null)
devicesdevices(): DevicesDevices (lazily instantiated, memoized)
areasareas(): AreasAreas
departmentsdepartments(): DepartmentsDepartments
positionspositions(): PositionsPositions
employeesemployees(): EmployeesEmployees
attendancesattendances(): AttendancesAttendances
resignsresigns(): ResignsResigns
clientclient(): ClientThe underlying Client
configconfig(): ConfigThe resolved Config

Config

namespace BioTime;

MethodSignatureReturns
__construct__construct(string $host, int $port, string $username, string $password, bool $https = false, bool $verify = false, int $timeout = 15, int $tokenTtlSeconds = 43200, string $tokenCacheKey = 'zkteco_device_token', ?CacheInterface $cache = null)
fromArraystatic fromArray(array $data): selfConfig
fromFilestatic fromFile(string $path): selfConfig (throws InvalidArgumentException if the file doesn't exist or doesn't return an array)
fromEnvstatic fromEnv(string $prefix = 'BIOTIME_'): selfConfig
autostatic auto(?string $configPath = null, array $overrides = []): selfConfig
baseUrlbaseUrl(): stringe.g. http://192.168.1.50:8081

See Configuration for what each field means.

Client

namespace BioTime;

MethodSignatureReturns
__construct__construct(Config $config, ?ClientInterface $http = null, ?TokenManager $tokenManager = null)
getget(string $endpoint, array $query = []): arrayDecoded JSON body
postpost(string $endpoint, array $data = []): arrayDecoded JSON body
putput(string $endpoint, array $data = []): arrayDecoded JSON body
deletedelete(string $endpoint): arrayDecoded JSON body
downloaddownload(string $endpoint, array $query = []): stringRaw response body (used by Attendances::export())

All methods throw ApiException on a non-2xx final response, and AuthenticationException if the request cannot be sent at all. See Error Handling.

Attendances

namespace BioTime\Resources; — endpoint base: /iclock/api/transactions/

MethodSignatureReturns
listlist(?string $startTime = null, ?string $endTime = null, int $page = 1, int $perPage = 50, array $filters = []): arrayEnvelope, data as AttendanceRecord[]
allall(?string $startTime = null, ?string $endTime = null, int $perPage = 200, array $filters = []): arrayAttendanceRecord[]
findfind(int $id): ?AttendanceRecord?AttendanceRecord
deletedelete(int $id): booltrue
exportexport(ExportType|string $exportType, array $filters = []): stringRaw export bytes

filters shape: array{emp_code?: string, terminal_sn?: string, terminal_alias?: string} (plus ordering).

Employees

namespace BioTime\Resources; — endpoint base: /personnel/api/employees/

MethodSignatureReturns
listlist(int $page = 1, int $perPage = 50, array $filters = []): arrayEnvelope, data as Employee[]
allall(array $filters = [], int $perPage = 200): arrayEmployee[]
findfind(string $empCode): ?Employee?Employee
findByIdfindById(int $id): ?Employee?Employee
createcreate(array $data): EmployeeEmployee
updateupdate(int $id, array $data): EmployeeEmployee
deletedelete(int $id): booltrue
adjustAreaadjustArea(array $employeeIds, array $areaIds): void
adjustDepartmentadjustDepartment(array $employeeIds, int $departmentId): void
adjustResignadjustResign(array $employeeIds, string $resignDate, int $resignType, bool $disableAtt, ?string $reason = null): void
delBioTemplatedelBioTemplate(array $employeeIds, bool $fingerPrint = false, bool $face = false, bool $fingerVein = false, bool $palm = false): void
resyncToDeviceresyncToDevice(array $employeeIds): void

filters shape: array{emp_code?: string, emp_code_icontains?: string, first_name?: string, first_name_icontains?: string, last_name?: string, last_name_icontains?: string, department?: int, areas?: int} (plus ordering).

WARNING

all()'s parameter order is (filters, perPage) — the reverse of every other resource's all(perPage, filters). Use named arguments to avoid mixing them up.

Devices

namespace BioTime\Resources; — endpoint base: /iclock/api/terminals/

MethodSignatureReturns
listlist(int $page = 1, int $perPage = 50, array $filters = []): arrayEnvelope, data as Device[]
allall(int $perPage = 200, array $filters = []): arrayDevice[]
findfind(string $sn): ?Device?Device
getget(int $id): DeviceDevice (throws ApiException if not found)
createcreate(array $payload): DeviceDevice
updateupdate(int $id, array $payload): DeviceDevice
deletedelete(int $id): void
clearCommandclearCommand(array $terminalIds): void
clearCaptureclearCapture(array $terminalIds): void
clearAllclearAll(array $terminalIds): void
uploadAlluploadAll(array $terminalIds): void
uploadTransactionuploadTransaction(array $terminalIds): void
rebootreboot(array $terminalIds): void

create()/update() payload shape: array{sn: string, alias: string, ip_address: string, terminal_tz?: int, heartbeat?: int, area?: int}.

Departments

namespace BioTime\Resources; — endpoint base: /personnel/api/departments/

MethodSignatureReturns
listlist(int $page = 1, int $perPage = 50, array $filters = []): arrayEnvelope, data as Department[]
allall(int $perPage = 200, array $filters = []): arrayDepartment[]
findfind(int $id): ?Department?Department
createcreate(array $data): DepartmentDepartment
updateupdate(int $id, array $data): DepartmentDepartment
deletedelete(int $id): booltrue

filters shape: array{dept_code?: string, dept_name?: string, dept_code_icontains?: string, dept_name_icontains?: string} (plus ordering).

Positions

namespace BioTime\Resources; — endpoint base: /personnel/api/positions/

MethodSignatureReturns
listlist(int $page = 1, int $perPage = 50, array $filters = []): arrayEnvelope, data as Position[]
allall(int $perPage = 200, array $filters = []): arrayPosition[]
findfind(int $id): ?Position?Position
createcreate(array $data): PositionPosition
updateupdate(int $id, array $data): PositionPosition
deletedelete(int $id): booltrue

filters shape: array{position_code?: string, position_name?: string, position_code_icontains?: string, position_name_icontains?: string} (plus ordering).

Areas

namespace BioTime\Resources; — endpoint base: /personnel/api/areas/

MethodSignatureReturns
listlist(int $page = 1, int $perPage = 50, array $filters = []): arrayEnvelope, data as Area[]
allall(int $perPage = 200, array $filters = []): arrayArea[]
findfind(int $id): ?Area?Area
createcreate(array $data): AreaArea
updateupdate(int $id, array $data): AreaArea
deletedelete(int $id): booltrue

filters shape: array{area_code?: string, area_name?: string, area_code_icontains?: string, area_name_icontains?: string} (plus ordering).

Resigns

namespace BioTime\Resources; — endpoint base: /personnel/api/resigns/

MethodSignatureReturns
listlist(int $page = 1, int $perPage = 50, array $filters = []): arrayEnvelope, data as Resign[]
allall(int $perPage = 200, array $filters = []): arrayResign[]
findByEmployeefindByEmployee(int $employeeId, int $page = 1, int $perPage = 50): arrayEnvelope, same shape as list()
findfind(int $id): ResignResign (throws ApiException if not found)
createcreate(array $payload): ResignResign
updateupdate(int $id, array $payload): ResignResign
deletedelete(int $id): void
reinstatementreinstatement(array $resignIds): void

create() payload shape: array{employee: int, resign_type: int, disableatt: bool, resign_date: string, reason?: string}. update() payload shape: array{resign_type?: int, disableatt?: bool, resign_date?: string, reason?: string}.

Shared pagination helper

AbstractResource::fetchAll() (protected, used internally by every resource's all()):

php
protected function fetchAll(string $endpoint, array $filters, callable $mapFn, int $perPage = 200): array

See Pagination for how it walks pages.

Distributed under the MIT License.