PHPackages                             hannes-kruger/php-ssh-connection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. hannes-kruger/php-ssh-connection

ActiveLibrary[HTTP &amp; Networking](/categories/http)

hannes-kruger/php-ssh-connection
================================

Provides an elegant syntax to connect to SSH servers and execute commands.

01PHP

Since Oct 8Pushed 3y agoCompare

[ Source](https://github.com/Hannes-Kruger/php-ssh-connection)[ Packagist](https://packagist.org/packages/hannes-kruger/php-ssh-connection)[ RSS](/packages/hannes-kruger-php-ssh-connection/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHP SSH Connection
==================

[](#php-ssh-connection)

[![Build Status](https://camo.githubusercontent.com/716825e7e4f4dca025e49c5a0faf664cdd70553bfd7e4ea7ad1d0327cebc46aa/68747470733a2f2f7472617669732d63692e636f6d2f446976696e654f6d6567612f7068702d7373682d636f6e6e656374696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/DivineOmega/php-ssh-connection)[![Coverage Status](https://camo.githubusercontent.com/43f177c1facd5bfa4e83501b419a90451a5e09597f920c555bf1da82d1ab5980/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f446976696e654f6d6567612f7068702d7373682d636f6e6e656374696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/DivineOmega/php-ssh-connection?branch=master)

The PHP SSH Connection package provides an elegant syntax to connect to SSH servers and execute commands. It supports both password and public-private keypair authentication, and can easily capture command output and errors.

Installation
------------

[](#installation)

You can install the PHP SSH Connection package by running the following Composer command.

```
composer require divineomega/php-ssh-connection
```

Usage
-----

[](#usage)

See the following basic usage instructions.

```
$connection = (new SSHConnection())
            ->to('test.rebex.net')
            ->onPort(22)
            ->as('demo')
            ->withPassword('password')
         // ->withPrivateKey($privateKeyPath)
         // ->timeout(0)
            ->connect();

$command = $connection->run('echo "Hello world!"');

$command->getOutput();  // 'Hello World'
$command->getError();   // ''

$connection->upload($localPath, $remotePath);
$connection->download($remotePath, $localPath);
```

For security, you can fingerprint the remote server and verify the fingerprint remains the same upon each subsequent connection.

```
$fingerprint = $connection->fingerprint();

if ($newConnection->fingerprint() != $fingerprint) {
    throw new Exception('Fingerprint does not match!');
}
```

If you wish, you can specify the type of fingerprint you wish to retrieve.

```
$md5Fingerprint  = $connection->fingerprint(SSHConnection::FINGERPRINT_MD5); // default
$sha1Fingerprint = $connection->fingerprint(SSHConnection::FINGERPRINT_SHA1);
```

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a2c41c325cba7db74084899160d9135c173a7bb902cf38508771f5655c815ee?d=identicon)[Hannes-Kruger](/maintainers/Hannes-Kruger)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (56 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")[![sboesch](https://avatars.githubusercontent.com/u/16945695?v=4)](https://github.com/sboesch "sboesch (2 commits)")[![Hannes-Kruger](https://avatars.githubusercontent.com/u/69590957?v=4)](https://github.com/Hannes-Kruger "Hannes-Kruger (1 commits)")[![sonaldo](https://avatars.githubusercontent.com/u/3761019?v=4)](https://github.com/sonaldo "sonaldo (1 commits)")

### Embed Badge

![Health badge](/badges/hannes-kruger-php-ssh-connection/health.svg)

```
[![Health](https://phpackages.com/badges/hannes-kruger-php-ssh-connection/health.svg)](https://phpackages.com/packages/hannes-kruger-php-ssh-connection)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.8k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M90](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
