1. Go to this page and download the library: Download utopia-php/orchestration 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/ */
utopia-php / orchestration example snippets
topia\Orchestration\Orchestration;
use Utopia\Orchestration\Adapter\DockerCLI;
// Initialise Orchestration with Docker CLI adapter.
$orchestration = new Orchestration(new DockerCLI());
// Pull the image.
$orchestration->pull('ubuntu:latest');
// Launch a ubuntu container that doesn't end using the tail command.
$containerID = $orchestration->run('ubuntu:latest', 'testContainer', ['tail', '-f', '/dev/null']);
$stderr = '';
$stdout = '';
// Execute a hello world command in the container
$orchestration->execute($containerID, ['echo', 'Hello World!'], $stdout, $stderr);
// Remove the container forcefully since it's still running.
$orchestration->remove($containerID, true);
use Utopia\Orchestration\Orchestration;
use Utopia\Orchestration\Adapter\DockerAPI;
$orchestration = new Orchestration(new DockerAPI($username, $password, $email));
use Utopia\Orchestration\Orchestration;
use Utopia\Orchestration\Adapter\DockerCLI;
$orchestration = new Orchestration(new DockerCLI($username, $password));