This is a wrapper for the API for Virtualizor. Documentation for this Version of the API can be found here: http://virtualizor.com/admin-api/#virtual-servers . Own Documentation will follow.
Install this library via composer is pretty easy.
composer require bennetgallein/virtualizor-php
And then you can get started with your project.
Every call starts by Initializing the Virtualizor
Object. Once initialized you can use it over and over again.
$virt = new \Virtualizor\Virtualizor("ip", "key", "pass", "port");
Get some information about the master
$info = json_decode($virt->serverInfo());
Create a new VirtualServer Object by using the following:
$virtualobject = $virt->vps();
Add Attributes and set the Act Method, then execute the query.
$vps = $virtualobject->setAct(\Virtualizor\Objects\VirtualServer::REBUILD)->setHostname("hostname_1")->exec();
Create a new IPPool Object by using the following:
$virtualobject = $virt->ippool();
List all pools:
$pools = $virtualobject->setAct(\Virtualizor\Objects\IPPool::LISTPOOLS)->exec();
Create a new OSTemplates Object by using the following:
$virtualobject = $virt->ostemplates();
List all templates:
$ostemplates = $virtualobject->setAct(\Virtualizor\Objects\OSTemplates::LISTOS)->exec();