PHP code example of cloudrepublic / shield-whatsapp-mfa

1. Go to this page and download the library: Download cloudrepublic/shield-whatsapp-mfa 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/ */

    

cloudrepublic / shield-whatsapp-mfa example snippets


public array $actions = [
    'register' => null,
    'login'    => \WhatsAppMfa\Authentication\Actions\WhatsAppMfa::class,
];

   public array $psr4 = [
       APP_NAMESPACE  => APPPATH,
       'WhatsAppMfa'  => APPPATH . 'ThirdParty/WhatsAppMfa/src',
   ];
   

   public array $actions = [
       'register' => null,
       'login'    => \WhatsAppMfa\Authentication\Actions\WhatsAppMfa::class,
   ];
   

   public array $actions = [
       'register' => \WhatsAppMfa\Authentication\Actions\WhatsAppActivator::class,
       'login'    => \WhatsAppMfa\Authentication\Actions\WhatsAppMfa::class,
   ];
   

public string $sender = \WhatsAppMfa\Sender\MetaCloudApiSender::class;
// or
public string $sender = \WhatsAppMfa\Sender\TwilioWhatsAppSender::class;

public string $channel = 'sms'; // default is 'whatsapp'

// app/Config/MfaDispatcher.php
public array $methodLabelResolvers = [
    'whatsapp' => [\WhatsAppMfa\Libraries\ChannelLabel::class, 'current'],
];

public array $views = [
    'whatsapp_mfa_show' => 'App\Views\auth\my_whatsapp_show',
    // any key you don't list keeps using this package's default
];

   public array $aliases = [
       // ... your existing aliases
       'whatsapp-fresh' => \WhatsAppMfa\Filters\RequireFreshWhatsApp::class,
   ];
   

   $routes->group('admin/billing', ['filter' => ['session', 'whatsapp-fresh']], static function ($routes) {
       $routes->get('stripe-settings', 'Admin\BillingController::index');
       $routes->post('stripe-settings', 'Admin\BillingController::update');
   });
   

public bool $stepUpRequiresEnrollment = true;
public string $stepUpEnrollRouteName  = 'whatsapp-settings-enroll'; // or
                                        // 'mfa-settings-whatsapp-enroll'
                                        // if using shield-mfa-dispatcher

   php spark whatsapp-mfa:setup