PHP code example of enguerr / vmware-api

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

    

enguerr / vmware-api example snippets


// Create a new API instance, endpoint should end on "/rest/".
$api = new \enguerr\VMWare\[Vcenter|Appliance|Inventory]IApi('https://vcenter.local/api/');

// LEGACY LOGIN WITH TOKEN
$api->login('yourusername', 'yourpassword');

$vms = $api->getListOfVms();

foreach($vms as $vm) {
    var_dump($vm);
}