PHP code example of duosecurity / duo_api_php

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

    

duosecurity / duo_api_php example snippets


$ git clone https://github.com/duosecurity/duo_api_php.git
$ cd duo_api_php
$ composer install

$ composer global 

$ php -a -d auto_prepend_file=vendor/autoload.php
Interactive mode enabled

php > $D = new DuoAPI\Auth($ikey, $skey, $host);
php > var_dump($D->preauth($username));
array(2) {
  'response' =>
  array(2) {
    'response' =>
    array(3) {
      'enroll_portal_url' =>
      string(23) "https://api-example.com"
      'result' =>
      string(6) "enroll"
      'status_msg' =>
      string(42) "Enroll an authentication device to proceed"
    }
    'stat' =>
    string(2) "OK"
  }
  'success' =>
  bool(true)
}