Created
August 20, 2016 22:58
-
-
Save cjmellor/9bfbd56fe675fe7dc9297c2a25b70710 to your computer and use it in GitHub Desktop.
Some helpers for the SSH Remote Collective for Laravel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Run a command on an environment through SSH | |
* | |
* @param array $commands | |
* @param bool $into | |
* @param string|null $env | |
* @return mixed | |
*/ | |
function ssh(array $commands, bool $into = false, string $env = null) | |
{ | |
if ($into) { | |
return SSH::into($env)->run($commands); | |
} | |
return SSH::run($commands); | |
} | |
/** | |
* Run a command and return the output through SSH. | |
* | |
* @param array $commands | |
* @return mixed | |
*/ | |
function ssh_live(array $commands) | |
{ | |
return SSH::run($commands, function ($line) { | |
echo $line.PHP_EOL; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment