PHP code example of raja-muhammad-asher / laravel-otp-mongodb

1. Go to this page and download the library: Download raja-muhammad-asher/laravel-otp-mongodb 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/ */

    

raja-muhammad-asher / laravel-otp-mongodb example snippets




use Asher\Otp\Otp;

(new Otp)->generate(string $identifier, string $type, int $length = 4, int $validity = 10);



use Asher\Otp\Otp;

(new Otp)->generate('[email protected]', 'numeric', 6, 15);



use Asher\Otp\Otp;

(new Otp)->validate(string $identifier, string $token)



use Asher\Otp\Otp;

(new Otp)->validate('[email protected]', '282581');


use Asher\Otp\Otp;

(new Otp)->isValid(string $identifier, string $token);



protected function schedule(Schedule $schedule)
{
    $schedule->command('otp:clean')->daily();
}
bash
php artisan migrate
bash
php artisan otp:clean