定制 velixbiometrics/sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

velixbiometrics/sdk

Composer 安装命令:

composer require velixbiometrics/sdk

包简介

SDK oficial do VELIX — controle de acesso biométrico

README 文档

README

⚠️ Alpha / pre-release. This SDK targets the real /v1/api/* API-key surface of api-velix-identity-core, defined in lib-velix-contracts/openapi/public-api.yaml (task #593). Only 6 endpoints exist today — anything else is not implemented.

Official PHP SDK for the VELIX Biometrics platform — facial access control B2B SaaS.

Requirements

  • PHP 8.1+
  • ext-json
  • Composer

Installation

composer require velix/sdk

Auth

All requests are authenticated with an API key issued per tenant application. Send it via the x-api-key header (default) or Authorization: Bearer vlx_... (accepted by the same guard). Never use any other auth mechanism.

Quick Start

use Velix\VelixClient;
use Velix\Modules\CheckinModule;

$client = new VelixClient([
    'apiUrl'  => $_ENV['VELIX_API_URL'],
    'apiKey'  => $_ENV['VELIX_API_KEY'],
    'timeout' => 30, // seconds; default is 30s (30000ms) per SDK contract, always overridable
]);

$result = (new CheckinModule($client))->identify($frameBase64);
echo $result->matched ? 'MATCHED' : 'NOT MATCHED';

Environment Variables

Variable Required Description
VELIX_API_URL Yes API base URL (https://api.velixbiometrics.com)
VELIX_API_KEY Yes API key (vlx_...)

Modules

Only the 6 real endpoints of /v1/api/* are implemented. PersonsModule, TenantsModule and WebhooksModule::configure() are kept for backward-compatible autoloading only — every method throws RuntimeException since no corresponding endpoint exists on the real API.

Module Method Endpoint Scope
OnboardingModule enroll() POST /v1/api/onboarding onboarding:write
CheckinModule identify() POST /v1/api/checkin/identify checkin:write
LgpdModule requestDeletion() POST /v1/api/deletion-request lgpd:write
MeModule get() GET /v1/api/me/{personId} me:read
EventsModule createGuest() POST /v1/api/events/{id}/guests events:write
EventsModule getGuest() GET /v1/api/events/{id}/guests/{guestId} events:read

Velix Time is not covered. No /v1/api/time/* endpoint exists in the backend yet (see task #616) — there is no Time-related class in this SDK to call.

Onboarding Module

use Velix\Modules\OnboardingModule;

$onboarding = new OnboardingModule($client);

$result = $onboarding->enroll('João Silva', [$frame1, $frame2, $frame3], [
    'email' => 'joao@company.com',
    'external_id' => 'EMP-001',
]);

// $result->personId, $result->identityId, $result->enrolled, $result->framesProcessed

Checkin Module

use Velix\Modules\CheckinModule;

$checkin = new CheckinModule($client);

$result = $checkin->identify($frameBase64, [
    'topK' => 3,
    'location' => ['latitude' => -23.55, 'longitude' => -46.63],
]);

// $result->matched, $result->personId, $result->qualityScore, $result->message
// Liveness score is never exposed — only booleans/messages.

qr() and pin() throw RuntimeException — no such endpoint exists in /v1/api/*.

Me Module

use Velix\Modules\MeModule;

$me = (new MeModule($client))->get('person-uuid');
// $me->id, $me->name, $me->email, $me->phone, $me->photoUrl, $me->createdAt

LGPD Module

use Velix\Modules\LgpdModule;

$result = (new LgpdModule($client))->requestDeletion('person-uuid');
// $result->protocolNumber, $result->message

Events Module

use Velix\Modules\EventsModule;

$events = new EventsModule($client);

$guest = $events->createGuest('event-uuid', [
    'name' => 'Maria Souza',
    'email' => 'maria@example.com',
]);

$guest = $events->getGuest('event-uuid', $guest->id);

list(), get(), create(), configure(), delete() throw RuntimeException — no such event-management endpoints exist in /v1/api/*.

Webhook Signature Validation

WebhooksModule::validateSignature() is a pure local helper (no HTTP call) and remains functional. WebhooksModule::configure() throws RuntimeException — no matching endpoint.

use Velix\Modules\WebhooksModule;

$valid = WebhooksModule::validateSignature(
    payload:   file_get_contents('php://input'),
    signature: $_SERVER['HTTP_X_VELIX_SIGNATURE'],
    secret:    $_ENV['VELIX_WEBHOOK_SECRET']
);

if (!$valid) {
    http_response_code(401);
    exit;
}

Error Handling

use Velix\Exceptions\AuthException;
use Velix\Exceptions\BiometricException;
use Velix\Exceptions\VelixException;

try {
    $result = $checkin->identify($frameBase64);
} catch (AuthException $e) {
    echo 'Invalid API key';
} catch (BiometricException $e) {
    echo 'Face not recognized or liveness failed';
} catch (VelixException $e) {
    echo "HTTP {$e->getCode()}: {$e->getMessage()}";
}

Running Tests

composer install
composer exec phpunit

Local Development

composer install
composer exec phpunit -- --testdox

Get an API Key

Access the dashboard at velixbiometrics.com → Settings → API Keys → New Key.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固