PHP code example of rinvex / laravel-authy

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

    

rinvex / laravel-authy example snippets


$authyApp = app('rinvex.authy.app');
$appStats = $authyApp->stats(); // Get app stats
$appDetails = $authyApp->details(); // Get app details

$authyUser = app('rinvex.authy.user');
$user = $authyUser->register('[email protected]', '317-338-9302', '54'); // Register user
$userActivity = $authyUser->registerActivity($user->get('user')['id'], 'cookie_login', 'Test Data'); // Register user activity
$userStatus = $authyUser->status($user->get('user')['id']); // Get user status
$userDeleted = $authyUser->delete($user->get('user')['id']); // Delete user

$authyToken = app('rinvex.authy.token');
$smsTokenSent = $authyToken->send($user->get('user')['id'], 'sms'); // Send SMS token
$callTokenStarted = $authyToken->send($user->get('user')['id'], 'call'); // Start automated call
$tokenVerified = $authyToken->verify(54321, $user->get('user')['id']); // Verify token

$body = $tokenVerified->body(); // Get all response body
$code = $tokenVerified->statusCode(); // Get response status code
$succeed = $tokenVerified->succeed(); // Check whether respose is a success
$failed = $tokenVerified->failed(); // Check whether respose is a failure
$message = $tokenVerified->message(); // Get response message
$item = $tokenVerified->get('item'); // Get response body item
$errors = $tokenVerified->errors(); // Get response errors

    'authy' => [
        'secret' => env('AUTHY_SECRET'),
    ],
    
ini
    AUTHY_SECRET=AuthySecretKey