Download the PHP package agazzi/vmwarephp without Composer

On this page you can find all versions of the php package agazzi/vmwarephp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package vmwarephp

Vmwarephp

Vmwarephp is a library containing bindings for vSphere API using PHP. You can use it to manage ESX and vCenter servers. It was inspired by other efforts of constructing vSphere bindings for other dynamically typed languages like RbvMomi for Ruby. Currently the library supports vSphere API from version 4.1 to 5.1.1.

Prerequisites

Vmwarephp requires PHP version 5.3.2 or greater with soap and ssl enabled. For more information on how to compile PHP from source and enable extensions please check: http://www.php.net/manual/en/install.php.

Installation

Vmwarephp can be installed using Composer or by cloning it from its GitHub repository.

Using Composer

You can read more about Composer and its main repository at http://packagist.org. To install Vmwarephp using Composer, first install Composer following the instructions on the Packagist home page. After that, you can define a dependency on Vmwarephp by adding the following lines to your composer.json:

{
    "require": {
        "vmwarephp/vmwarephp": "dev-master"
    }
}

Using Git / GitHub

You can clone the latest development branch from its github repository:

git clone git://github.com/vadimcomanescu/vmwarephp.git

Usage

Vmwarephp aims to provide the least boilerplate code possibile for handling vSphere objects. The ESX/vCenter on which the operations are performed is represented by a \Vmwarephp\Vhost object. A Vhost object provides two finder methods to obtain server side ManagedObjects. The following example describes a way to collect all virtual machines from a ESX/vCenter with their config status prefetched:

$vhost = new \Vmwarephp\Vhost('vcenter:443', 'Admin', 'password');
$virtualMachines = $vhost->findAllManagedObjects('VirtualMachine', array('configStatus'));

For collecting all virtual machines with all their properties pre-fetched, which normally is a very expensive operation considering that a lot of objects need to be traversed you can do it in the following way:

$virtualMachines = $vhost->findAllManagedObjects('VirtualMachine', 'all');

You can find a given object using its server side id. For example finding a datastore with id datastore-182 with none of its properties prefetched:

$vhost = new \Vmwarephp\Vhost('vcenter:443', 'Admin', 'password');
$datastore = $vhost->findOneManagedObject('Datastore', 'datastore-182', array());

A managed object can also be found by name:

$vhost = new \Vmwarephp\Vhost('vcenter:443', 'Admin', 'password');
$datastore = $vhost->findManagedObjectByName('VirtualMachine', 'myvmname', array('configStatus'));

Managed objects can be a generic managed object represented by \Vmwarephp\ManagedObject or a user defined extension of a managed object defined in Extensions directory. Each managed object depending on its managed object reference type ('VirtualMachine', 'Datastore', etc.) can execute any of methods defined by the vSphere api on that reference type. For example taking a virtual machine snapshot can be as easy as:

$vhost = new \Vmwarephp\Vhost('vcenter:443', 'Admin', 'password');
$virtualMachine = $vhost->findOneManagedObject('VirtualMachine', 'vm-192', array());
$snapshotTask = $virtualMachine->CreateSnapshot_Task(array('name' => 'snapshot_name', 'memory' => false, 'quiesce' => false));

or considering that the VirtualMachine managed object type has a built in extension already:

$snapshotTask = $virtualMachine->takeSnapshot(array('name' => 'snapshot_name', 'memory' => false, 'quiesce' => false));

All managed object properties are defined as object accessors. You can pre-fetch all accessors when looking for the object or you can query an object property on the fly (note that we are not pre-fetching the configStatus property):

$virtualMachine = $vhost->findOneManagedObject('VirtualMachine', 'vm-192', array());
$configStatus = $virtualMachine->configStatus;

Or prefetching the configStatus:

$virtualMachine = $vhost->findOneManagedObject('VirtualMachine', 'vm-192', array('configStatus'));

As you can see working with managed objects is extremely easy. Each method supported by a managed object on the server side is mapped to a method on \Vmwarephp\ManagedObject or an extension. Properties are exposed as simple accessor methods. All data object properties are also mapped to their respective types. A full list of defined types can be found in TypeDefinitions.inc file.

You can write your own extensions by extending the \Vmwarephp\ManagedObject and adding it to Extensions directory. If you consider the extensions is really useful we can easily integrate it in the main branch. Enjoy!


All versions of vmwarephp with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package agazzi/vmwarephp contains the following files

Loading the files please wait ....