projectmata/mobile-biometrics

Biometric authentication plugin for NativePHP Mobile

Maintainers

Package info

github.com/jomarmata24/mobile-biometrics

Language:Kotlin

Type:nativephp-plugin

pkg:composer/projectmata/mobile-biometrics

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-25 03:37 UTC

This package is auto-updated.

Last update: 2026-04-25 03:42:12 UTC


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.0 or ^12.0 / ^13.0
  • nativephp/mobile
  • Android: min_version 33 (depends on androidx.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 requires NSFaceIDUsageDescription in Info.plist; add it to your app's info_plist config if you target Face ID devices.

License

MIT