PHP code example of codetyme / laravel-temp-password

1. Go to this page and download the library: Download codetyme/laravel-temp-password 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/ */

    

codetyme / laravel-temp-password example snippets


return [
    'enabled' => env('TEMP_PASS_ENABLED', true),

    'expiry_minutes' => env('TEMP_PASS_EXPIRY_TIME', 5), // Valid for 5 minutes

    'length' => env('TEMP_PASS_LENGTH', 8), // Default password length

    'strength' => env('TEMP_PASS_STRENGTH', 'medium'), // simple | medium | strong
];

use codetyme\TempPassword\Facades\TempPass;

// Using default settings
$password = TempPass::generate($user);

// Custom length
$password = TempPass::generate($user, 12);

// Custom length + strength
$password = TempPass::generate($user, 16, 'strong');

$user = App\Models\User::first();
$password = TempPass::generate($user);

Auth::attempt(['email' => $user->email, 'password' => $password]); // returns true ✅
bash
php artisan vendor:publish --provider="codetyme\TempPassword\TempPassServiceProvider" --tag=config
php artisan migrate
bash
php artisan temp-password:generate
bash
php artisan tinker