PHP code example of ichtrojan / laravel-otp

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

    

ichtrojan / laravel-otp example snippets




use Ichtrojan\Otp\Otp;

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



use Ichtrojan\Otp\Otp;

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



use Ichtrojan\Otp\Otp;

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



use Ichtrojan\Otp\Otp;

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



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