Downloads
Stars
Version
Laravel Forge is awesome, right? Yes it is - but there's one thing it's missing - a proper API.
That's why this library exists - Blacksmith is an unofficial Laravel Forge API to automate common tasks.
The API is still improving and I will keep adding features, as I need them.
use Mpociot\Blacksmith\Blacksmith;
$blacksmith = new Blacksmith($email, $password);
Returns a Collection of Server
objects.
$activeServers = $blacksmith->getActiveServers();
Returns a Collection of Site
objects.
$sites = $blacksmith->getSites();
Returns a single Server
object.
$server = $blacksmith->getServer(1);
Returns a single Server
object with a provision url.
The following example will create a Load Balancer with a custom provider
$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',
]);
Returns a single Site
object.
$site = $blacksmith->getSite(1);
Returns a Collection of Circle
objects of the user.
$circles = $blacksmith->getCircles();
Returns a single Circle
object.
$circle = $blacksmith->getCircle(1);
Returns a single Circle
object.
$circle = $blacksmith->addCircle('Name of Circle');
Returns a Collection of Recipe
objects.
$recipes = $blacksmith->getRecipes();
Returns a single Recipe
object.
$recipe = $blacksmith->getRecipe(1);
Returns a single Recipe
object.
$recipe = $blacksmith->addRecipe('RecipeName', 'root', 'Recipe contents');
Returns a Collection of Site
objects for the server.
$sites = $server->getSites();
Returns a the newly created Site
object or throws an exception if errors occur.
$newSite = $server->addSite($site_name, $project_type = 'php', $directory = '/public', $wildcards = false);
Add a SSH key to a server
$server->addSSHKey('Name SSH key', 'Contents of SSH key');
$server->removeSSHKey(1);
Update the metadata of the current site, and return an updated Server
object or throws an exception if errors occur.
$server = $server->updateMetadata($server_name, $ip_address, $private_ip_address, $size);
Returns a Collection of ScheduledJob
objects for the server.
$jobs = $server->getScheduledJobs();
Returns a the newly created ScheduledJob
object or throws an exception if errors occur.
$newJob = $server->addScheduledJob($command, $user = 'forge', $frequency = 'minutely');
Returns an array containing all available server information.
$data = $server->toArray();
Returns the configured .env file
$env_content = $site->getEnvironment();
Install and deploy an application to the site.
$site->installApp($repository, $provider = 'github', $branch = 'master', $composer = true, $migrate = false);
Deploys an application on this site.
$site->deploy();
Returns the last deployment log for this site.
$site->deployLog();
Returns an array containing all available site information.
$data = $site->toArray();
Returns a fresh Circle
object or throws an exception if errors occur.
$circle = $circle->inviteMember('[email protected]');
If you want to delete a member you update a circle with all member id's.
It return a fresh Circle
object.
$circle = $circle->setMembers([1,2]);
If you want to add or delete a server from the circle you update a circle with all server id's.
It return a fresh Circle
object.
$circle = $circle->setServers([1,2]);
$recipe = $recipe->update($name, $user, $script);
Blacksmith is free software distributed under the terms of the MIT license.