diff --git a/README.markdown b/README.markdown index 3d1e7e0..640cbe7 100644 --- a/README.markdown +++ b/README.markdown @@ -27,10 +27,10 @@ the following lines to your composer.json: { "require": { - "vmwarephp/vmwarephp": "dev-master" + "vmwarephp/vmwarephp": "~0.1@dev" } } - + **Using Git / GitHub** You can clone the latest development branch from its github repository: @@ -41,10 +41,10 @@ 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 +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')); @@ -63,39 +63,33 @@ 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 +'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 + +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. +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! - - - - - - diff --git a/composer.json b/composer.json index b8d032b..33a7ecb 100644 --- a/composer.json +++ b/composer.json @@ -1,24 +1,33 @@ { - "name":"vmwarephp/vmwarephp", - "type":"library", - "description":"Vmware vSphere bindings for PHP", - "keywords":["vmware", "php", "vsphere", "bindings", "vsphere sdk", "vmware php"], - "homepage":"https://github.com/vadimcomanescu/vmwarephp", - "license":"BSD-3-Clause", - "authors":[ - { - "name":"Vadim Comanescu", - "email":"vadim984@gmail.com", - "homepage":"http://vadimcomanescu.wordpress.com" - } - ], - "require":{ - "php":">=5.3.2" - }, - "require-dev":{ - "mockery/mockery":"dev-master" - }, - "autoload": { - "psr-0": { "Vmwarephp": "library" } + "name": "vmwarephp/vmwarephp", + "type": "library", + "description": "Vmware vSphere bindings for PHP", + "keywords": ["vmware", "php", "vsphere", "bindings", "vsphere sdk", "vmware php"], + "homepage": "https://github.com/vadimcomanescu/vmwarephp", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Vadim Comanescu", + "email": "vadim984@gmail.com", + "homepage": "http://vadimcomanescu.wordpress.com" } + ], + "require": { + "php": ">=5.3.2", + "ext-soap": "*", + "ext-openssl": "*" + }, + "require-dev": { + "mockery/mockery": "~1.0@dev" + }, + "autoload": { + "psr-0": { + "Vmwarephp": "library" + } + }, + "extra": { + "branch-alias": { + "dev-master": "0.1-dev" + } + } }