degagne / libssh2
PHP SSH2 wrapper library
Installs: 2 001
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 3
Requires
- php: >=5.4.0
- ext-ssh2: *
This package is not auto-updated.
Last update: 2024-10-27 06:18:17 UTC
README
LibSSH2 implements all supported SSH2 functions from the libssh2 extension.
Requirements
- PHP >= 5.4
- libssh2 Extension
Installation
Add libssh2 package to your composer.json file.
{ "require": { "degagne/libssh2": "~1.2.1" } }
or run
composer require degagne/libssh2
Usage
$configuration = (new Configuration()) ->set_username('username') ->set_password('password') ->set_host('hostname'); $authentication = new Password($configuration); $ssh = new SSH($configuration, $authentication); $ssh->exec('ls -ltr'); $output = $ssh->get_output(); // stdout $errors = $ssh->get_error(); // stderr $retval = $ssh->get_exitstatus(); // return code
With Kerberos:
$kerberos = new Kerberos($configuration, $authentication); $krb_cache = $kerberos->kcreate('principle'); $ssh->exec("export KRBCCNAME={$krb_cache};ls -ltr");
Kerberos requires the use of the KRBCCNAME environmental variable to be set.