Skip to content

kakawait/Jumper

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Jumper

Build Status Code Coverage Scrutinizer Quality Score Dependency Status

Allow you to execute PHP Closure in other distant computer via SSH and without client/server setup.

Source computer dependency: PHP >= 5.3 (so might work on windows but untested)

Target computer dependencies: PHP >= 5.3, SSHd

<?php

require 'vendor/autoload.php';

$authentication = new \Jumper\Communicator\Authentication\Rsa('root', $_SERVER['HOME'] . '/.ssh/id_rsa');
$communicator = new \Jumper\Communicator\Ssh($authentication, array('host' => '127.0.0.1'));

$executor = new \Jumper\Executor($communicator, new Jumper\Stringifier\Native());

$array = array(2, 1, 4, 3);
$rsortedArray = $executor->run(
    function() use ($array) {
        rsort($array); 
        return $array;
    }
);

var_dump($rsortedArray);
// should print
/*
array(4) {
  [0]=>
  int(4)
  [1]=>
  int(3)
  [2]=>
  int(2)
  [3]=>
  int(1)
}
*/