projectmata / mobile-biometrics
Biometric authentication plugin for NativePHP Mobile
Package info
github.com/jomarmata24/mobile-biometrics
Language:Kotlin
Type:nativephp-plugin
pkg:composer/projectmata/mobile-biometrics
Requires
- php: ^8.1
README
Biometric authentication plugin for NativePHP Mobile. Exposes fingerprint / Face ID / device-credential authentication to your Laravel + NativePHP app on Android and iOS.
Requirements
- PHP
^8.1 - Laravel
^11.0or^12.0/^13.0 nativephp/mobile- Android:
min_version 33(depends onandroidx.biometric:biometric:1.2.0-alpha05) - iOS:
min_version 18.2
Installation
composer require projectmata/mobile-biometrics
Laravel auto-discovery registers the service provider and facade automatically — no edits to config/app.php or bootstrap/providers.php needed.
After installing, rebuild the mobile app so NativePHP picks up the new plugin manifest:
php artisan native:run android
# or
php artisan native:run ios
Usage
PHP (Laravel)
use Projectmata\MobileBiometrics\Facades\Biometrics; // Is biometric hardware available & enrolled? $status = Biometrics::isAvailable(); // What authenticators does the device expose? $types = Biometrics::getTypes(); // Prompt the user to authenticate $result = Biometrics::authenticate( reason: 'Confirm your identity to continue', title: 'Unlock', subtitle: 'Use your fingerprint or face', negativeButton: 'Cancel', ); if ($result['success'] ?? false) { // authenticated }
JavaScript (in-app)
The plugin registers itself on window.NativePHP.Biometrics:
const available = await window.NativePHP.Biometrics.IsAvailable(); const types = await window.NativePHP.Biometrics.GetTypes(); const result = await window.NativePHP.Biometrics.Authenticate({ reason: 'Confirm your identity', title: 'Unlock', subtitle: '', negativeButton: 'Cancel', });
You can also import the module directly if you bundle it:
import Biometrics, { authenticate } from 'projectmata-mobile-biometrics';
Bridge methods
| Method | Params | Returns |
|---|---|---|
Biometrics.IsAvailable |
— | { success, available, reason } |
Biometrics.GetTypes |
— | { success, types[] } |
Biometrics.Authenticate |
reason, title, subtitle, negativeButton |
{ success, message } |
Return payloads are whatever the native plugin resolves; at minimum each call returns a success boolean and a message on failure.
Platform notes
- Android — Uses AndroidX Biometric. Requires the device to have a biometric enrolled (or a device credential fallback, depending on config).
- iOS — Uses
LAContext(Touch ID / Face ID). Face ID requiresNSFaceIDUsageDescriptioninInfo.plist; add it to your app'sinfo_plistconfig if you target Face ID devices.
License
MIT