PHP code example of whyounes / laravel-two-factor-auth
1. Go to this page and download the library: Download whyounes/laravel-two-factor-auth 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/ */
whyounes / laravel-two-factor-auth example snippets
// app/User.php
class User extends Authenticatable
{
use \Whyounes\TFAuth\Models\TFAuthTrait;
// ...
}
use Whyounes\TFAuth\Contracts\VerificationCodeSenderInterface;
class MyService implements VerificationCodeSenderInterface
{
public function sendCodeViaSMS($code, $phone, $message = "Your verification code is %s")
{
// Send code and return boolean for status
}
public function sendCodeViaPhone($code, $phone, $message = "Your verification code is %s")
{
// Send code and return boolean for status
}
}
use Whyounes\TFAuth\Contracts\VerificationCodeSenderInterface;
class AppProvider extends ServiceProvider
{
public function register()
{
// ...
$this->app->bind(VerificationCodeSenderInterface::class, MyService::class);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.