PHPackages                             paulvl/ssh - 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. paulvl/ssh

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

paulvl/ssh
==========

A package to execute commands over an SSH connection using phpseclib

v1.0.1(6y ago)14MITPHPPHP &gt;=5.6.1CI failing

Since Apr 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/paulvl/ssh)[ Packagist](https://packagist.org/packages/paulvl/ssh)[ RSS](/packages/paulvl-ssh/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

SSH
---

[](#ssh)

SSH is a small and functional package that allow the commands execution over an SSH connection using phpseclib.

**Quick Installation**
----------------------

[](#quick-installation)

Begin by installing this package through Composer.

You can run:

```
composer require paulvl/ssh

```

Or edit your project's composer.json file to require paulvl/ssh.

```
 "require": {
     ...
     "paulvl/ssh": "1	.*"
}
```

Next, update Composer from the Terminal:

```
composer update

```

Once the package's installation completes, you can start using the library to connect to your servers and excutes comands:

```
/*
create and ssh instance passing:
- server IP
- username
- private key value
- ssh port number
*/
$ssh = new SHH\SSH(
	'your.own.server.ip',
	'username',
	'your-private-key',
	22);
```

**SSH functions**
-----------------

[](#ssh-functions)

### **canConnect** - Test the connection

[](#canconnect---test-the-connection)

To evaluate if the host can be connected with the given parameteres call the `canConnect` function:

```
$ssh->canConnect();
```

This will return `true` if the connection is successful.

### **connect** - Open the connection to the host

[](#connect---open-the-connection-to-the-host)

To open the connection with te given parameters call the `connect` function:

```
$ssh->connect();
```

Every timw you want to check the connection status

### **disconnect** - Close the connection to the host

[](#disconnect---close-the-connection-to-the-host)

To close the current open connection call the `disconnect` function:

```
$ssh->disconnect();
```

### **run** - Excecutes commands within the current connection

[](#run---excecutes-commands-within-the-current-connection)

To execute commands on within the current open connection you should pass an array of commands as a parameter calling the `run` function:

```
$ssh->run(['command-1', 'command-2']);
```

You will get and array as result where you can see and unique execution id, the exit status of the executed command, the cli output as result and the duration in milliseconds.

```
[0] => Array
(
    [id] => 3e75a0e9-3de8-4c57-8a4b-a858af602089
    [status] => true
    [result] => command output message
    [duration] => 0.362
)

```

**Contribute and share ;-)**
----------------------------

[](#contribute-and-share--)

If you like this little piece of code share it with you friends and feel free to contribute with any improvements.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

2226d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8fdef0e996f65b82fd2c344429cd17177695635620eb34908c87dfbccd062fe0?d=identicon)[paulvl](/maintainers/paulvl)

---

Tags

phppackagesshlibrary

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/paulvl-ssh/health.svg)

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

###  Alternatives

[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)

PHPackages © 2026

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