Method Reference
All signatures below are taken directly from the source (src/). Optional parameters show their default value.
BioTime
namespace BioTime;
| Method | Signature | Returns |
|---|---|---|
__construct | __construct(?Config $config = null, ?ClientInterface $httpClient = null) | — |
devices | devices(): Devices | Devices (lazily instantiated, memoized) |
areas | areas(): Areas | Areas |
departments | departments(): Departments | Departments |
positions | positions(): Positions | Positions |
employees | employees(): Employees | Employees |
attendances | attendances(): Attendances | Attendances |
resigns | resigns(): Resigns | Resigns |
client | client(): Client | The underlying Client |
config | config(): Config | The resolved Config |
Config
namespace BioTime;
| Method | Signature | Returns |
|---|---|---|
__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) | — |
fromArray | static fromArray(array $data): self | Config |
fromFile | static fromFile(string $path): self | Config (throws InvalidArgumentException if the file doesn't exist or doesn't return an array) |
fromEnv | static fromEnv(string $prefix = 'BIOTIME_'): self | Config |
auto | static auto(?string $configPath = null, array $overrides = []): self | Config |
baseUrl | baseUrl(): string | e.g. http://192.168.1.50:8081 |
See Configuration for what each field means.
Client
namespace BioTime;
| Method | Signature | Returns |
|---|---|---|
__construct | __construct(Config $config, ?ClientInterface $http = null, ?TokenManager $tokenManager = null) | — |
get | get(string $endpoint, array $query = []): array | Decoded JSON body |
post | post(string $endpoint, array $data = []): array | Decoded JSON body |
put | put(string $endpoint, array $data = []): array | Decoded JSON body |
delete | delete(string $endpoint): array | Decoded JSON body |
download | download(string $endpoint, array $query = []): string | Raw 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/
| Method | Signature | Returns |
|---|---|---|
list | list(?string $startTime = null, ?string $endTime = null, int $page = 1, int $perPage = 50, array $filters = []): array | Envelope, data as AttendanceRecord[] |
all | all(?string $startTime = null, ?string $endTime = null, int $perPage = 200, array $filters = []): array | AttendanceRecord[] |
find | find(int $id): ?AttendanceRecord | ?AttendanceRecord |
delete | delete(int $id): bool | true |
export | export(ExportType|string $exportType, array $filters = []): string | Raw 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/
| Method | Signature | Returns |
|---|---|---|
list | list(int $page = 1, int $perPage = 50, array $filters = []): array | Envelope, data as Employee[] |
all | all(array $filters = [], int $perPage = 200): array | Employee[] |
find | find(string $empCode): ?Employee | ?Employee |
findById | findById(int $id): ?Employee | ?Employee |
create | create(array $data): Employee | Employee |
update | update(int $id, array $data): Employee | Employee |
delete | delete(int $id): bool | true |
adjustArea | adjustArea(array $employeeIds, array $areaIds): void | — |
adjustDepartment | adjustDepartment(array $employeeIds, int $departmentId): void | — |
adjustResign | adjustResign(array $employeeIds, string $resignDate, int $resignType, bool $disableAtt, ?string $reason = null): void | — |
delBioTemplate | delBioTemplate(array $employeeIds, bool $fingerPrint = false, bool $face = false, bool $fingerVein = false, bool $palm = false): void | — |
resyncToDevice | resyncToDevice(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/
| Method | Signature | Returns |
|---|---|---|
list | list(int $page = 1, int $perPage = 50, array $filters = []): array | Envelope, data as Device[] |
all | all(int $perPage = 200, array $filters = []): array | Device[] |
find | find(string $sn): ?Device | ?Device |
get | get(int $id): Device | Device (throws ApiException if not found) |
create | create(array $payload): Device | Device |
update | update(int $id, array $payload): Device | Device |
delete | delete(int $id): void | — |
clearCommand | clearCommand(array $terminalIds): void | — |
clearCapture | clearCapture(array $terminalIds): void | — |
clearAll | clearAll(array $terminalIds): void | — |
uploadAll | uploadAll(array $terminalIds): void | — |
uploadTransaction | uploadTransaction(array $terminalIds): void | — |
reboot | reboot(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/
| Method | Signature | Returns |
|---|---|---|
list | list(int $page = 1, int $perPage = 50, array $filters = []): array | Envelope, data as Department[] |
all | all(int $perPage = 200, array $filters = []): array | Department[] |
find | find(int $id): ?Department | ?Department |
create | create(array $data): Department | Department |
update | update(int $id, array $data): Department | Department |
delete | delete(int $id): bool | true |
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/
| Method | Signature | Returns |
|---|---|---|
list | list(int $page = 1, int $perPage = 50, array $filters = []): array | Envelope, data as Position[] |
all | all(int $perPage = 200, array $filters = []): array | Position[] |
find | find(int $id): ?Position | ?Position |
create | create(array $data): Position | Position |
update | update(int $id, array $data): Position | Position |
delete | delete(int $id): bool | true |
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/
| Method | Signature | Returns |
|---|---|---|
list | list(int $page = 1, int $perPage = 50, array $filters = []): array | Envelope, data as Area[] |
all | all(int $perPage = 200, array $filters = []): array | Area[] |
find | find(int $id): ?Area | ?Area |
create | create(array $data): Area | Area |
update | update(int $id, array $data): Area | Area |
delete | delete(int $id): bool | true |
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/
| Method | Signature | Returns |
|---|---|---|
list | list(int $page = 1, int $perPage = 50, array $filters = []): array | Envelope, data as Resign[] |
all | all(int $perPage = 200, array $filters = []): array | Resign[] |
findByEmployee | findByEmployee(int $employeeId, int $page = 1, int $perPage = 50): array | Envelope, same shape as list() |
find | find(int $id): Resign | Resign (throws ApiException if not found) |
create | create(array $payload): Resign | Resign |
update | update(int $id, array $payload): Resign | Resign |
delete | delete(int $id): void | — |
reinstatement | reinstatement(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()):
protected function fetchAll(string $endpoint, array $filters, callable $mapFn, int $perPage = 200): arraySee Pagination for how it walks pages.