PHP code example of xelon-ag / vmware-php-client
1. Go to this page and download the library: Download xelon-ag/vmware-php-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/ */
xelon-ag / vmware-php-client example snippets
return [
'session_ttl' => env('VMWARE_SESSION_TTL', 10),
'enable_logs' => env('VMWARE_ENABLE_LOGS', true),
];
$vcenterClient = new Xelon\VmWareClient\VcenterClient(
'https://10.20.30.40',
'mylogin',
'mypassword'
);
$vmInfo = $vcenterClient->getVmInfo('vm-123');
$vcenterClient = new Xelon\VmWareClient\VcenterClient(
'https://10.20.30.40',
'mylogin',
'mypassword',
'soap'
);
$vcenterClient = new Xelon\VmWareClient\VcenterClient(
'https://10.20.30.40',
'mylogin',
'mypassword',
Xelon\VmWareClient\VcenterClient::MODE_SOAP
);
$folder = $vcenterClient->soap->createFolder('group-v3', 'foldername');
$vcenterClient = new Xelon\VmWareClient\VcenterClient(
'https://10.20.30.40',
'mylogin',
'mypassword',
Xelon\VmWareClient\VcenterClient::MODE_SOAP
);
$taskInfo = $vcenterClient->soap->request('ReconfigureComputeResource_Task', [
'_this' => [
'_' => 'domain-c33',
'type' => 'ComputeResource',
],
'spec' => [
'@type' => 'ClusterConfigSpecEx',
'drsConfig' => [
'@type' => 'ClusterDrsConfigInfo',
],
'rulesSpec' => [
'@type' => 'ClusterRuleSpec',
'operation' => 'add',
'info' => [
'@type' => 'ClusterAntiAffinityRuleSpec',
'enabled' => true,
'name' => 'VM-VM Affinity rule',
'userCreated' => true,
'vm' => [
['_' => 'vm-133', 'type' => 'VirtualMachine'],
['_' => 'vm-134', 'type' => 'VirtualMachine']
]
],
],
'dpmConfig' => [
'@type' => 'ClusterDpmConfigInfo',
],
],
'modify' => false,
])
bash
php artisan vendor:publish --tag="vmware-php-client-config"