PHP code example of mpociot / blacksmith
1. Go to this page and download the library: Download mpociot/blacksmith 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/ */
mpociot / blacksmith example snippets
use Mpociot\Blacksmith\Blacksmith;
$blacksmith = new Blacksmith($email, $password);
$activeServers = $blacksmith->getActiveServers();
$sites = $blacksmith->getSites();
$server = $blacksmith->getServer(1);
$server = $blacksmith->addServer([
'backups' => false,
'database' => 'forge',
'hhvm' => false,
'ip_address' => '94.212.124.121',
'maria' => false,
'name' => 'harmonious-lagoon',
'nodeBalancer' => true,
'old_php' => false,
'php_version' => 'php70',
'private_ip_address' => '10.0.0.2',
'provider' => 'custom',
'size' => '2',
'timezone' => 'Europe/Berlin',
]);
$site = $blacksmith->getSite(1);
$circles = $blacksmith->getCircles();
$circle = $blacksmith->getCircle(1);
$circle = $blacksmith->addCircle('Name of Circle');
$recipes = $blacksmith->getRecipes();
$recipe = $blacksmith->getRecipe(1);
$recipe = $blacksmith->addRecipe('RecipeName', 'root', 'Recipe contents');
$sites = $server->getSites();
$newSite = $server->addSite($site_name, $project_type = 'php', $directory = '/public', $wildcards = false);
$server->addSSHKey('Name SSH key', 'Contents of SSH key');
$server->removeSSHKey(1);
$server = $server->updateMetadata($server_name, $ip_address, $private_ip_address, $size);
$jobs = $server->getScheduledJobs();
$newJob = $server->addScheduledJob($command, $user = 'forge', $frequency = 'minutely');
$data = $server->toArray();
$env_content = $site->getEnvironment();
$site->installApp($repository, $provider = 'github', $branch = 'master', $composer = true, $migrate = false);
$site->deploy();
$site->deployLog();
$data = $site->toArray();
$circle = $circle->inviteMember('[email protected] ');
$circle = $circle->setMembers([1,2]);
$circle = $circle->setServers([1,2]);
$recipe = $recipe->update($name, $user, $script);