PHP code example of wuninsu / nativephp-biometrics
1. Go to this page and download the library: Download wuninsu/nativephp-biometrics 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/ */
wuninsu / nativephp-biometrics example snippets
use Wuninsu\NativeBiometrics\Facades\Biometrics;
$status = Biometrics::status();
$status->available; // hardware present and a finger or face enrolled
$status->biometry; // face, fingerprint, iris, optic, multiple, none, unknown
$status->reason; // when not available: not_enrolled, no_hardware, unavailable, lockout, no_passcode, unsupported, plugin_missing
$status->deviceSecure; // the phone has a PIN, pattern or passcode
use Wuninsu\NativeBiometrics\Events\Completed;
Biometrics::prompt()
->title('Unlock MyApp')
->subtitle('Confirm it is you') // Android only
->reason('Unlock your account') // iOS; defaults to the title
->cancelLabel('Use password')
->allowDeviceCredential() // optional: the phone's PIN/passcode may stand in
->completed(function (Completed $event) {
// $event->success, $event->error
})
->start();
use Wuninsu\NativeBiometrics\Events\Completed;
public function handle(Completed $event): void
{
if ($event->success) {
// unlocked
} elseif ($event->cancelled()) {
// the user chose cancel
}
}