2017 © Pedro Peláez
 

library sshwrapper

SSH wrapper for PHP

image

wiardvanrij/sshwrapper

SSH wrapper for PHP

  • Saturday, October 21, 2017
  • by wiardvanrij
  • Repository
  • 1 Watchers
  • 3 Stars
  • 20 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

SSH wrapper for PHP

Information

!!! This is in very beta. I would not recommend using this on production or whatsoever. !!!, (*1)

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:, (*2)

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, (*3)

Installation

Via composer, (*4)

{
    "require": {
        "wiardvanrij/sshwrapper": "*"
    }
}

Because this library is in beta, please use the latest version. There is no stable, (*5)

Usage

Require the autoloader and include the namespace, (*6)

<?php

require('vendor/autoload.php');

use SshWrapper\SshCore;

Initiate the class with the host, (*7)

$ssh = new SshCore('123.123.123.123');

Optional: Define the rsa public and private key locations if they differ from default. Defaults:, (*8)

$ssh->authPriv = '~/.ssh/id_rsa';
$ssh->authPub = '~/.ssh/id_rsa.pub';

Optional: Define user and port if they differ from the default. Defaults:, (*9)

$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., (*10)

$ssh->jumphost = 'root@321.321.321.321';

Connect, (*11)

$ssh->connect();

And execute a command, (*12)

$result = $ssh->exec('ls -lah');

var_dump($result);

Result is a string of the output, (*13)

Disconnect to close the ssh connection, (*14)

$ssh->disconnect();

The Versions

21/10 2017

dev-master

9999999-dev https://github.com/wiardvanrij/sshwrapper

SSH wrapper for PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

1.1.1

1.1.1.0 https://github.com/wiardvanrij/sshwrapper

SSH wrapper for PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

1.1

1.1.0.0 https://github.com/wiardvanrij/sshwrapper

SSH wrapper for PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

1.0.1

1.0.1.0 https://github.com/douweegbertje/sshwrapper

Server information written in PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

1.0.0

1.0.0.0 https://github.com/douweegbertje/sshwrapper

Server information written in PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

0.05

0.05.0.0 https://github.com/douweegbertje/sshwrapper

Server information written in PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

0.04

0.04.0.0 https://github.com/douweegbertje/sshwrapper

Server information written in PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

0.03

0.03.0.0 https://github.com/douweegbertje/sshwrapper

Server information written in PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

0.02

0.02.0.0 https://github.com/douweegbertje/sshwrapper

Server information written in PHP

  Sources   Download

MIT

by Wiard van Rij

21/10 2017

0.01

0.01.0.0 https://github.com/douweegbertje/sshwrapper

Server information written in PHP

  Sources   Download

MIT

by Wiard van Rij