PHP code example of padosoft / laravel-rebel-recovery
1. Go to this page and download the library: Download padosoft/laravel-rebel-recovery 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/ */
padosoft / laravel-rebel-recovery example snippets
use Padosoft\Rebel\Recovery\RecoveryCodeManager;
$recovery = app(RecoveryCodeManager::class);
// At enrolment: generate and SHOW ONCE (cannot be retrieved again)
$codes = $recovery->generate($user, count: 10);
// → ["A1B2-C3D4-E5F6-G7H8-J9K0", ...] display/download these now
// Later: the user submits one code to recover access
if ($recovery->verify($user, $request->string('code'))) {
// consumed — let them through (ideally behind a high-assurance step-up)
}
$recovery->remaining($user); // how many codes are left
bash
composer vendor:publish --tag="rebel-recovery-migrations"
php artisan migrate