Hi I'll comment on this as I'm the developer and maintainer of
libvirt_image_create($conn, $name, $size, $format)
This API is only for creation of the virtual machine image (the virtual disk for the virtual machine). It doesn't do kind of domain (virtual machine) creation. You don't need it if you use PXE/network boot and similar.
libvirt_domain_new($conn, $name, $arch, $memMB, $maxmemMB, $vcpus,
$iso_image, $disks, $networks, $flags)
This is for installation of the new virtual machine. First of all, you need to connect to libvirt daemon instance using
libvirt_connect(). The return value of
libvirt_connect() is the pointer/resource you need to pass as the first argument of this function. Then, you have to provide a virtual machine name, architecture (i686 or x86_64), initial and maximum memory in Megabytes (see the system specifications for operating system you want to install there first), number of VCPUs, ISO image to install this from (for PXE boot you don't require this and you can pass 'false' there), array of disk information (may be false too) and network cards.
The flags are optional and you don't have to pass them. Please refer to examples directory of the
libvirt-php installation for real-world example - this is better than something written in here. Installation itself is a complex task so that's why it requires too many information
This creates the domain identified by a resource. The resource is basically already existing domain found by
libvirt_domain_lookup_*() API functions.
This creates one time domain that's not persistent. This domain is just run once as based on the libvirt XML file.
For format of libvirt XML files please refer to libvirt documentation, not libvirt-php.