1. Go to this page and download the library: Download tareef/laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tareef / laravel example snippets
use Tareef\Laravel\Facades\Tareef;
$result = Tareef::verify($request->file('selfie'));
if ($result->matched) {
return "Welcome back, {$result->name}.";
}
Tareef::delete($uuid);
// or, if you already have the object:
$person->delete();
if (! Tareef::health()) {
Log::warning('Tareef is unreachable.');
}
use Tareef\Laravel\Exceptions\{
FaceAlreadyExistsException,
NoFaceDetectedException,
QuotaExceededException,
AuthenticationException,
ServiceUnavailableException,
TareefException,
};
try {
$person = Tareef::register(name: $name, images: [$file]);
} catch (FaceAlreadyExistsException $e) {
// Same face is already enrolled — fetch the existing record.
$existing = Tareef::find($e->existingUuid);
return back()->with('warning', "Already enrolled as {$existing->name}.");
} catch (NoFaceDetectedException $e) {
return back()->withErrors(['photo' => 'No face was detected. Try a clearer photo.']);
} catch (QuotaExceededException) {
return redirect()->route('billing')->with('error', 'Plan quota exhausted.');
} catch (AuthenticationException) {
Log::critical('TAREEF_API_KEY is missing or revoked.');
abort(500);
} catch (ServiceUnavailableException) {
return back()->with('error', 'Tareef is having issues. Try again in a minute.');
} catch (TareefException $e) {
report($e);
return back()->with('error', $e->getMessage());
}
$person->uuid; // string
$person->name; // ?string
$person->phone; // ?string
$person->imageCount; // int
$person->images; // string[] — URLs/paths returned by the API
$person->createdAt; // ?Carbon\Carbon
$person->addImages([$file]); // → Person
$person->verify($file); // → VerifyResult (1:1 against this person)
$person->delete(); // → bool
$person->toArray(); // → array
$result->matched; // bool — branch on this
$result->uuid; // ?string (the matched person's UUID, if any)
$result->name; // ?string
$result->score; // ?float (lower = closer; <0.35 = confident match)
$result->samples; // ?int (how many reference photos contributed)
$result->status; // see below
$result->message; // ?string
$result->personUuid; // ?string (set when you verified against one person)
$result->lowQualityImage; // bool (the query photo was small or soft)
$result->wasScopedToPerson(); // bool — was this a 1:1 check?
$result->match; // bool — same person? (uses the app's strictness)
$result->distance; // ?float (cosine distance; lower = closer)
$result->similarity; // ?float (1 − distance; 1.0 = identical)
$result->threshold; // ?float (the cutoff the decision used)
$result->status; // 'ok'