2017 © Pedro Peláez
 

library lib-system-ssh

SSH system library of the Ride framework

image

ride/lib-system-ssh

SSH system library of the Ride framework

  • Tuesday, August 30, 2016
  • by ride-user
  • Repository
  • 10 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Ride: SSH System Library

SSH system abstraction library of the PHP Ride framework., (*1)

Code Sample

Check this code sample to see the possibilities of this library:, (*2)

```php <?php, (*3)

use ride\library\system\System; use ride\library\system\SshSystem;, (*4)

// password authentication $authentication = new PasswordSshAuthentication(); $authentication->setUsername('username'); $authentication->setPasswword('password');, (*5)

// public key authentication $authentication = new PublicKeySshAuthentication(); $authentication->setUsername('username'); $authentication->setPublicKeyFile('/path/to/public-key'); $authentication->setPrivateKeyFile('/path/to/private-key'); $authentication->setPrivateKeyPassphrase('passphrase'); // optional, (*6)

// create the ssh system $remoteSystem = new SshSystem($authentication, 'my-ssh-host.com', 22);, (*7)

// optional host key verifycation $remoteSystem->setHostKeys(array( 'host:port' => 'fingerprint', ));, (*8)

// optional connect and disconnect $remoteSystem->connect(); $remoteSystem->disconnect();, (*9)

// check the client $remoteSystem->getClient(); // username, (*10)

// execute a command $output = $remoteSystem->execute('whoami');, (*11)

$code = null; $output = $remoteSystem->execute('crontab -l', $code);, (*12)

// file system abstraction $remoteFileSystem = $remoteSystem->getFileSystem();, (*13)

$dir = $remoteFileSystem->getFile('path/to/dir'); $dir->isDirectory(); $dir->isReadable(); $files = $dir->read();, (*14)

$file = $remoteFileSystem->getFile('path/to/file'); $file->exists(); $file->getModificationTime(); $content = $file->read();, (*15)

// remote copy $destination = $dir->getChild($file->getName()); $destination = $destination->getCopyFile();, (*16)

$file->copy($destination);, (*17)

// download a file $localSystem = new System(); $localFileSystem = $localSystem->getFileSystem(); $localFile = $localFileSystem->getFile('path/to/download');, (*18)

$file->copy($localFile);, (*19)

The Versions

30/08 2016

dev-master

9999999-dev

SSH system library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

30/08 2016

dev-develop

dev-develop

SSH system library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

30/08 2016

0.1.0

0.1.0.0

SSH system library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd