Skip to content

A simple PHP library for establishing SSH connections using the ext-ssh2 extension.

Notifications You must be signed in to change notification settings

cesargb/php-ssh2-client

Repository files navigation

PHP SSH2 Client

A PHP SSH2 client wrapper providing a clean and modern interface to the ssh2 extension.

Usage

require 'vendor/autoload.php';

use Cesargb\Ssh\SshClient;

$sshClient = new SshClient('your-ssh-server.com');

$sshSession = $sshClient->connect();

$fingerprint = $sshSession->fingerPrint();
echo "Server Fingerprint: {$fingerprint}\n";

$sshSession->withAuthPublicKey('username', '/path/to/public/key.pub', '/path/to/private/key');

$commandOutput = $sshSession->exec('ls -la');
echo "Command Output:\n{$commandOutput}\n";

$sshSession->disconnect();

Testing

composer test

About

A simple PHP library for establishing SSH connections using the ext-ssh2 extension.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages