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 4w ago

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 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity24

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

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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