Skip to content

Instantly share code, notes, and snippets.

@bayareawebpro
Created November 2, 2017 23:07
Show Gist options
  • Save bayareawebpro/f48103040ae42aa19b24f54307ce0114 to your computer and use it in GitHub Desktop.
Save bayareawebpro/f48103040ae42aa19b24f54307ce0114 to your computer and use it in GitHub Desktop.
Call Envoy from Route
<?php
$result = [];
$task = 'deploy';
$live = true;
$process = new \Symfony\Component\Process\Process('/Applications/MAMP/bin/php/php7.1.0/bin/php ~/.composer/vendor/bin/envoy run '. $task);
$process->setTimeout(3600);
$process->setIdleTimeout(300);
$process->setWorkingDirectory(base_path());
$process->run(
function ($type, $buffer) use ($live, &$result) {
$buffer = str_replace('[-i ~/.ssh/host_key user@host.com]: ', '', $buffer);
if ($live) {
echo $buffer . '</br />';
}
$result[] = $buffer;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment