yoonik/face-api

Functionalities for biometric processing (detection, verification and identification) for Youverse.Face.

v1.0.5 2022-10-24 15:34 UTC

This package is auto-updated.

Last update: 2025-05-23 20:29:05 UTC


README

https://yk-website-images.s3.eu-west-1.amazonaws.com/LogoV4_TRANSPARENT.png

Youverse Face API Client SDK PHP

License Version

This repository implements an integration SDK to facilitate the consumption of the Youverse.Face API, an Youverse Services offering.

For more information please contact us.

Requirements

PHP 5.5 and later

Getting Started

composer require youverse/face-api

Example

Verifies the faces similarity between two images in base 64

require dirname(__DIR__) . '/vendor/autoload.php';

$apiKey = "YOUR-X-API-KEY";
$baseUrl = "YOUR-API-ENDPOINT";
$image1 = "<IMAGE_PATH>";
$image2 = "<IMAGE_PATH>";

$client = new Youverse\Face\Client\Face(
    $apiKey,
    $baseUrl
);

$payload = new Youverse\Face\Model\VerifyImages();

//convert image 1 to base64
$img = file_get_contents($image1);
$imgdata = base64_encode($img);
$payload->setFirstImage($imgdata);

//convert image 2 to base64
$img = file_get_contents($image2);
$imgdata = base64_encode($img);
$payload->setSecondImage($imgdata);

try {
    $result = $client->verifyImages($payload);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FaceApi->verifyImages: ', $e->getMessage(), PHP_EOL;
}

If you're interested in using Youverse.Face API for identification purposes, please visit our examples.