PHPackages                             degagne/libssh2 - 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. degagne/libssh2

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

degagne/libssh2
===============

PHP SSH2 wrapper library

v1.2.0(8y ago)02.6k1[3 issues](https://github.com/degagne/libssh2/issues)1MITPHPPHP &gt;=5.4.0

Since Jan 23Pushed 8y ago2 watchersCompare

[ Source](https://github.com/degagne/libssh2)[ Packagist](https://packagist.org/packages/degagne/libssh2)[ Docs](https://github.com/degagne/libssh2)[ RSS](/packages/degagne-libssh2/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)DependenciesVersions (3)Used By (1)

LibSSH2
=======

[](#libssh2)

[![Latest Stable Version](https://camo.githubusercontent.com/f85c2f6644345cf4a4dc069f1dc9cc5eba4a1a433cd89e157a690be65bfa04dd/68747470733a2f2f706f7365722e707567782e6f72672f64656761676e652f6c6962737368322f762f737461626c65)](https://packagist.org/packages/degagne/libssh2) [![Latest Unstable Version](https://camo.githubusercontent.com/cf3315a3c8105a71983ff6ea16a96ecb4ed23d339d96e1ee9772e83ad87e874e/68747470733a2f2f706f7365722e707567782e6f72672f64656761676e652f6c6962737368322f762f756e737461626c65)](https://packagist.org/packages/degagne/libssh2) [![License](https://camo.githubusercontent.com/80edc02960918b34c00d2682b5fa3aa1bf536849f990df49767b762dcde6f122/68747470733a2f2f706f7365722e707567782e6f72672f64656761676e652f6c6962737368322f6c6963656e7365)](https://packagist.org/packages/degagne/libssh2) [![composer.lock](https://camo.githubusercontent.com/1b2ef23c768f4f06c5e81a82464594a91d3c2286d7dcbfe893704f718480951d/68747470733a2f2f706f7365722e707567782e6f72672f64656761676e652f6c6962737368322f636f6d706f7365726c6f636b)](https://packagist.org/packages/degagne/libssh2) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/0fbc4d8c22114add27547646a158e0954aa6cd78c548456f8819a3676fb78183/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656761676e652f6c6962737368322f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/degagne/libssh2/?branch=master) [![Build Status](https://camo.githubusercontent.com/fb6e52aaf0ea8144a551b878f90e56ae9b3508a3d24b3d81f1a40ae80f97065c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656761676e652f6c6962737368322f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/degagne/libssh2/build-status/master) [![Code Intelligence Status](https://camo.githubusercontent.com/ab8d6896c579a8f50928e12bcfe8305ff04f45c5d60d275e647b3feb0d795a9e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656761676e652f6c6962737368322f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

LibSSH2 implements all supported SSH2 functions from the libssh2 extension.

Requirements
============

[](#requirements)

- PHP &gt;= 5.4
- libssh2 Extension

Installation
============

[](#installation)

Add libssh2 package to your composer.json file.

```
{
    "require": {
        "degagne/libssh2": "~1.2.1"
    }
}
```

or run `composer require degagne/libssh2`

Usage
=====

[](#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.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3072d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10094284?v=4)[ddegagne](/maintainers/ddegagne)[@ddegagne](https://github.com/ddegagne)

---

Top Contributors

[![degagne](https://avatars.githubusercontent.com/u/22967651?v=4)](https://github.com/degagne "degagne (24 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (4 commits)")

---

Tags

phpssh2libssh2

### Embed Badge

![Health badge](/badges/degagne-libssh2/health.svg)

```
[![Health](https://phpackages.com/badges/degagne-libssh2/health.svg)](https://phpackages.com/packages/degagne-libssh2)
```

###  Alternatives

[hannesvdvreken/guzzle-debugbar

A Guzzle middleware that logs requests to debugbar's timeline

76423.5k2](/packages/hannesvdvreken-guzzle-debugbar)

PHPackages © 2026

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