PHP code example of xenolope / grizzwald

1. Go to this page and download the library: Download xenolope/grizzwald 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/ */

    

xenolope / grizzwald example snippets


// Create a new instance of the client, passing in the base URL to your fleet instance
$client = new FleetClient('http://172.16.1.100:49153');

// Get a list of all the machines in the cluster
$machines = $client->listMachines(); // Returns an array of \Xenolope\Grizzwald\Entity\Machine objects

// Get a list of all the unit states in the cluster
$states = $client->listUnitStates(); // Returns an array of \Xenolope\Grizzwald\Entity\UnitState objects

// Get a list of all the units in the cluster
$units = $client->listUnits(); // Returns an array of \Xenolope\Grizzwald\Entity\Unit objects

// Get a single unit from the cluster
$unit = $client->getUnit('nginx.service'); // Returns a \Xenolope\Grizzwald\Entity\Unit object

// Create a new unit on the cluster
$unit = new Unit('nginx.service', [
    new UnitOption('Service', 'ExecStart', '/usr/sbin/nginx') // One or more UnitOptions are