https://github.com/wiardvanrij/sshwrapper
This library allows you to connect via SSH to your linux server with the PHP core class 'ssh2'. It also allows to use a "jump server"
https://github.com/wiardvanrij/sshwrapper
php php-library php7 ssh ssh-client
Last synced: about 1 year ago
JSON representation
This library allows you to connect via SSH to your linux server with the PHP core class 'ssh2'. It also allows to use a "jump server"
- Host: GitHub
- URL: https://github.com/wiardvanrij/sshwrapper
- Owner: wiardvanrij
- License: mit
- Created: 2017-10-21T15:28:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-21T18:32:40.000Z (over 8 years ago)
- Last Synced: 2025-04-10T07:54:57.558Z (about 1 year ago)
- Topics: php, php-library, php7, ssh, ssh-client
- Language: PHP
- Homepage: https://www.sysrant.com
- Size: 9.77 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SSH wrapper for PHP
## Information
!!! This is in very beta. I would not recommend using this on production or whatsoever. !!!
This library allows you to connect via SSH to your linux server with the PHP core class 'ssh2'.
It also allows to use a "jump server" for instance:
command --ssh to-> jump server --ssh to-> actual server
## Requirements
You will need to install the PHP ssh2 extension and enable this. I assume you have knowledge on how to install php extensions
## Installation
Via composer
{
"require": {
"wiardvanrij/sshwrapper": "*"
}
}
Because this library is in beta, please use the latest version. There is no stable
## Usage
Require the autoloader and include the namespace
authPriv = '~/.ssh/id_rsa';
$ssh->authPub = '~/.ssh/id_rsa.pub';
Optional: Define user and port if they differ from the default. Defaults:
$ssh->authUser = 'root';
$ssh->port = 22;
Prefered: If you use the ssh server as "jump server" you can define the actual server here including the user.
$ssh->jumphost = 'root@321.321.321.321';
Connect
$ssh->connect();
And execute a command
$result = $ssh->exec('ls -lah');
var_dump($result);
Result is a string of the output
Disconnect to close the ssh connection
$ssh->disconnect();