Skip to content

Simple replacement for Collective Remote package

License

Notifications You must be signed in to change notification settings

simonecosci/ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ssh

Simple replacement for Laravel Collective Remote package

Install

composer require phpseclib/phpseclib

Place SshService.php in app/Services

Place remote.php in config/

Usage

...

use App\Services\SshService as SSH;

$username = 'root';
$password = 'password';
$id = 'my-host';
config(['remote.connections.' . $id => [
    'host' => '127.0.0.1:22',
    'username' => $username,
    'password' => $password,
    'key' => '',
    'keytext' => '',
    'keyphrase' => '',
    'agent' => '',
    'timeout' => 0,
]]);

$connection = SSH::into($id);

// run a command
$output = $connection->run('ls -la');

// run multiple commands
$output = $connection->run(['ls -la', 'pwd']);

// upload a file
$connection->putFile('test.txt');

// create a file remotely
$connection->putString('test.txt', 'content of the file');

About

Simple replacement for Collective Remote package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages