Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Fingerprintbundle Laravel Package

xlabs/fingerprintbundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the package via Composer:

    composer require xlabs/fingerprintbundle
    

    Register the bundle in config/app.php under providers:

    Xlabs\FingerprintBundle\FingerprintServiceProvider::class,
    

    Publish the configuration (if needed):

    php artisan vendor:publish --provider="Xlabs\FingerprintBundle\FingerprintServiceProvider" --tag="config"
    
  2. Basic Usage Inject the FingerprintManager service into a controller or service:

    use Xlabs\FingerprintBundle\Services\FingerprintManager;
    
    public function __construct(private FingerprintManager $fingerprintManager) {}
    

    Capture a fingerprint (simplified example):

    $fingerprintData = $this->fingerprintManager->capture();
    
  3. First Use Case: Enrollment Enroll a user’s fingerprint (assuming a User model):

    $user = User::find(1);
    $this->fingerprintManager->enroll($user, $fingerprintData);
    

Implementation Patterns

Workflow: Fingerprint Authentication

  1. Capture Trigger the device’s fingerprint scanner (hardware/software) via:

    $fingerprintData = $this->fingerprintManager->capture();
    

    Note: May require frontend integration (e.g., JavaScript SDK) for mobile/web apps.

  2. Verification Check against stored templates:

    $isMatch = $this->fingerprintManager->verify($user, $fingerprintData);
    
  3. Fallback Handling Use middleware to redirect to alternative auth (e.g., OTP) if fingerprint fails:

    if (!$isMatch) {
        return redirect()->route('auth.otp');
    }
    

Integration Tips

  • Database Schema Extend your users table with:
    Schema::table('users', function (Blueprint $table) {
        $table->string('fingerprint_template')->nullable();
        $table->timestamp('fingerprint_enrolled_at')->nullable();
    });
    
  • Event Listeners Listen for enrollment events to log or notify:
    public function handle(FingerprintEnrolled $event) {
        Log::info("User {$event->user->id} enrolled fingerprint.");
    }
    
  • Rate Limiting Protect against brute-force attacks:
    $this->fingerprintManager->verify($user, $data, maxAttempts: 3);
    

Gotchas and Tips

Pitfalls

  1. Hardware Dependency

    • Issue: Fingerprint scanners vary by device (e.g., Windows Hello vs. Android Biometrics).
    • Fix: Use a wrapper library (e.g., webauthn for web) or document supported devices.
  2. Data Sensitivity

    • Issue: Fingerprint templates are biometric data; comply with GDPR/CCPA.
    • Fix: Encrypt templates at rest and implement strict access controls.
  3. Fallback Logic

    • Issue: Users may lack fingerprint hardware.
    • Fix: Gracefully degrade to password/OTP auth with clear UX messaging.

Debugging

  • Logs Enable debug mode in config/fingerprint.php:

    'debug' => env('APP_DEBUG', false),
    

    Check logs for FingerprintBundle entries.

  • Template Validation Verify template storage/format:

    $this->fingerprintManager->validateTemplate($user->fingerprint_template);
    

Extension Points

  1. Custom Storage Override the default template storage (e.g., AWS S3):

    $this->fingerprintManager->setStorage(new S3FingerprintStorage());
    
  2. Multi-Factor Integration Combine with Laravel’s built-in auth:

    if ($this->fingerprintManager->verify($user, $data)) {
        Auth::login($user, remember: true);
    }
    
  3. Testing Mock the FingerprintManager in PHPUnit:

    $mock = Mockery::mock(FingerprintManager::class);
    $mock->shouldReceive('verify')->andReturn(true);
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
likyly/sdk
tdt/input
coreation/php-shapefile
coreation/gisconverter
primix/widgets
primix/notifications
primix/actions
primix/tables
primix/details
primix/forms
primix/support
marcelgwerder/laravel-api-handler
firebrikdotcom/conveyor-laravel-broadcaster
kanata-php/conveyor-laravel-broadcaster
alish/short-message
sonrac/lumen-league-oauth2
pushery/sanctum-hardening-for-laravel
evanschleret/laravel-uuidable
yigit-serin/laravel-openvidu
adachsoft/command-executor-lib