PHPackages                             yjtec/linssh2 - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. yjtec/linssh2

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yjtec/linssh2
=============

php ssh2

09PHP

Since Sep 29Pushed 6y agoCompare

[ Source](https://github.com/yjtec/linssh2)[ Packagist](https://packagist.org/packages/yjtec/linssh2)[ RSS](/packages/yjtec-linssh2/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHP SSH2
========

[](#php-ssh2)

We use this library to execute commands over [`Secure Shell2 for PHP`](http://www.php.net/manual/en/book.ssh2.php). Particularly opening an interactive shell and executing a chain of commands programmatically via that shell.

Example Connecting to a Unix Server
-----------------------------------

[](#example-connecting-to-a-unix-server)

```
require_once 'SSH2.php';
// Test Unix
$username = 'someuser';
$password = 'somepwd';
$host = 'somenixhost.com';
$port = 22;
$ssh2 = new My_SSH2($host, $port);
$ssh2->authPassword( $username, $password);
$ssh2->setPrompt(':~#'); // Set initial expected prompt
$ssh2->openShell();
$ssh2->setPrompt("MYCUSTOMSSHPROMPT> "); // Create a unique, easily found prompt
$ssh2->exec("PS1='MYCUSTOMSSHPROMPT> '"); // Execute the command.
echo $ssh2->exec('cd /var/www') . "\n";   // Change directories.
echo $ssh2->exec('pwd') . "\n";           // Print working directory
echo "\n===================Begin History=============\n";
echo $ssh2->getHistory();
$ssh2->disconnect();
echo "\n===================end=============\n";
exit;

```

Example Connecting to a Windows Server
--------------------------------------

[](#example-connecting-to-a-windows-server)

```
require_once 'SSH2.php';
// Test Unix
$username = 'someuser';
$password = 'somepwd';
$host = 'somewin32host.com';
$port = 22;
$ssh2 = new My_SSH2($host, $port);
$ssh2->authPassword( $username, $password);
$ssh2->setPrompt(':~#'); // Set initial expected prompt
$ssh2->openShell();
$ssh2->setPrompt("MYCUSTOMSSHPROMPT>"); // Create a unique, easily found prompt
$ssh2->exec("prompt MYCUSTOMSSHPROMPT$G"); // Execute the command.
echo $ssh2->exec('cd c:\\temp') . "\n";   // Change directories.
echo $ssh2->exec('chdir') . "\n";           // Print working directory
echo "\n===================Begin History=============\n";
echo $ssh2->getHistory();
$ssh2->disconnect();
echo "\n===================end=============\n";
exit;``

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 58.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://avatars.githubusercontent.com/u/48311842?v=4)[Yjtec](/maintainers/Yjtec)[@yjtec](https://github.com/yjtec)

---

Top Contributors

[![bubba-h57](https://avatars.githubusercontent.com/u/603630?v=4)](https://github.com/bubba-h57 "bubba-h57 (7 commits)")[![biuio](https://avatars.githubusercontent.com/u/20262245?v=4)](https://github.com/biuio "biuio (5 commits)")

### Embed Badge

![Health badge](/badges/yjtec-linssh2/health.svg)

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

###  Alternatives

[phpro/soap-client

A general purpose SoapClient library

8885.6M46](/packages/phpro-soap-client)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[typo3/cms-reports

TYPO3 CMS Reports - Show status reports and installed services in the (System&gt;Reports) backend module.

137.1M58](/packages/typo3-cms-reports)[lcharette/uf_formgenerator

Form generator for UserFrosting V5

178.7k3](/packages/lcharette-uf-formgenerator)

PHPackages © 2026

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