Skip to content

Instantly share code, notes, and snippets.

@shawnsandy
Last active February 18, 2017 02:06
Show Gist options
  • Save shawnsandy/39754749fb2472c3d8e050f3d0553d09 to your computer and use it in GitHub Desktop.
Save shawnsandy/39754749fb2472c3d8e050f3d0553d09 to your computer and use it in GitHub Desktop.
SSH commands in Laravel
<?php
use Collective\Remote\RemoteFacade as SSH;
class SampleSSH {
public function getFile()
{
try {
SSH::into('production')->get('/var/www/.env', public_path('/env/example.env-' . Carbon::now()), function ($line) {
Log::info($line);
return $line;
});
return "success";
} catch (Exception $exception) {
return $exception->getMessage();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment