Download the PHP package faraweilyas/sshbunny without Composer
On this page you can find all versions of the php package faraweilyas/sshbunny. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download faraweilyas/sshbunny
More information about faraweilyas/sshbunny
Files in faraweilyas/sshbunny
Package sshbunny
Short Description PHP library that provides an object-oriented wrapper to connect to SSH and run shell commands with the php ssh2 extension.
License MIT
Homepage https://github.com/faraweilyas/sshbunny
Informations about the package sshbunny
sshbunny
PHP library that provides an object-oriented wrapper to connect to SSH and run shell commands with the php ssh2 extension.
Requirements
- PHP version 5.3+
- SSH2 extension.
- composer.
Install with composer
The best way to add the library to your project is using composer.
or
Clone this repo
Configuration
SSHBunny
constructor takes four parameters and they all have default values $method='local'
, $authType=NULL
, $host=NULL
, $port=22
, $username=NULL
$method
can be set tolocal
orremote
,local
will execute commands on your own shell without internet connection whileremote
executes commands on the remote server that you connect to based on your configuration.$authType
can be set toKEY
,PASSWORD
orKEY_PASSWORD
,KEY
andKEY_PASSWORD
uses ssh2_auth_pubkey_file the difference is when you set$authType='KEY_PASSWORD'
ssh2_auth_pubkey_file takes the last parameter of password which will now be required andPASSWORD
uses ssh2_auth_password.$port
should be set to your server port if your are connecting to a remote server.$username
should be set to your server username.
if your are setting connection method to $method='remote'
and $authType = KEY || KEY_PASSWORD
that means you will need to set your public & private key file which you can do with the setters SSHBunny
has $sshBunny->setKeys('public_key.pub', 'private_key')
before initialization.
Basic usage
This is just going to run locally since connection method is set to local
This is going connect to a remote server since connection method is set to remote
and authentication type is set to KEY
Command execution can take multiple commands or you can chain on the exec
method with another exec
method
Available methods
-
Executed command output
-
Clear stored executed command output
- Disconnect server connection