PHP code example of jenwachter / php-rsync

1. Go to this page and download the library: Download jenwachter/php-rsync library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jenwachter / php-rsync example snippets


$connection = new PhpRsync\Connection($type);
$rsync = new Rsync($connection);

$local = new PhpRsync\Connection(
  'local',
  '/path/to/destination/root/dir'
);

$rsync = new Rsync($local);

$remote = new PhpRsync\Connection(
  'remote',
  '/path/to/destination/root/dir',
  'remote.host.com',
  'username',
  ['ssh_key' => '/path/to/ssh/key']
);

$rsync = new Rsync($remote);

$akamai = new PhpRsync\Connection(
  'akamai',
  '/path/to/destination/root/dir',
  'cpcode.rsync.upload.akamai.com',
  'username',
  ['ssh_key' => '/path/to/ssh/key']
);

$rsync = new Rsync($akamai);

$options = [];

$rsync->run(
  '/path/to/source/dir',
  'relative/path/to/destination/dir',
  $options
);
bash
composer