PHP code example of art-of-wifi / unifi-api-client

1. Go to this page and download the library: Download art-of-wifi/unifi-api-client 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/ */

    

art-of-wifi / unifi-api-client example snippets


/**
 * load the class using the composer autoloader
 */

/**
 * load the class directly instead of using the composer autoloader
 */

/**
 * load the class directly instead of using the composer autoloader
 */

/**
 * load the class using the composer autoloader
 */
in to the controller and request the alarms collection
 * (this example assumes you have already assigned the correct values to the variables used)
 */
$unifi_connection = new UniFi_API\Client($controller_user, $controller_password, $controller_url, $site_id, $controller_version, true);
$login            = $unifi_connection->login();
$results          = $unifi_connection->list_alarms(); // returns a PHP array containing alarm objects