2017 © Pedro Peláez
 

library rsync

rsync wrapper library for php

image

xobotyi/rsync

rsync wrapper library for php

  • Friday, July 20, 2018
  • by xobotyi
  • Repository
  • 6 Watchers
  • 50 Stars
  • 168 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 630 % Grown

The README.md

Rsync

License PHP 7 ready Build Status Codacy Grade Scrutinizer Code Quality Codacy Coverage Latest Stable Version Total Downloads , (*1)

About

Rsync is a pure PHP 7.1+ dependency-free wrapper for rsync client. It provides you a simple way to abstract from command line control rsync right from php. Library uses PSR-4 autoloader standard and always has 100% tests coverage.
There is no need to tell about rsync, except the fact that php doesn't has any faster or equal built-in way to upload files to remote server., (*2)

Library supports whole bunch of options and parameters implemented in rsync client version 3.1.2, (*3)

Why Rsync?

1) It is small and fully covered with tests 2) It is well documented 3) I'm eating my own sweet pie=) 4) Supports whole bunch of parameters and options of rsync and ssh 5) Easy to use 6) Works on Windows (ofcourse id you installed ssh and rsync clients for Windows), (*4)

Requirements

  • PHP 7.1+
  • PHP config variables_order must contain E, 4ex: variables_order=EGPCS.
    Otherwise you will have to manually specify absolute path to rsync and ssh binaries (at least on Windows)
  • rsync client 3.1.2 +

Installation

Install with composer, (*5)

composer require xobotyi/rsync

Docs

The code is well documented, for methods and parameters descriptions see the sources., (*6)

Usage

Simplest:, (*7)

use xobotyi\rsync\Rsync;

$rsync = new Rsync();
$rsync->sync('/path/to/source', '/path/to/destination');

If you need SSH:, (*8)

use xobotyi\rsync\Rsync;
use xobotyi\rsync\SSH;

$rsync = new Rsync([
                       Rsync::CONF_CWD        => __DIR__,
                       Rsync::CONF_EXECUTABLE => '/even/alternative/executable/rsync.exe',
                       Rsync::CONF_SSH        => [
                           SSH::CONF_EXECUTABLE => '/even/alternative/executable/ssh.exe',
                           SSH::CONF_OPTIONS    => [
                               SSH::OPT_OPTION              => ['BatchMode=yes', 'StrictHostKeyChecking=no'],
                               SSH::OPT_IDENTIFICATION_FILE => './path/to/ident',
                               SSH::OPT_PORT                => 2222,
                           ],
                       ],
                   ]);
$rsync->sync('./relative/path/to/source', 'user@some.remote.lan:/abs/path/to/destination');
echo './relative/path/to/source ' . ($rsync->getExitCode() === 0 ? 'successfully synchronized with remote.' : 'not synchronised due to errors.') . "\n";

$rsync->setExecutable('ssh')
      ->setOption(SSH::OPT_OPTION, false)// 'false' value turns off the options
      ->setOptions([
                       SSH::OPT_IDENTIFICATION_FILE => './new/path/to/ident',
                       SSH::OPT_PORT                => 22,
                   ]);
$rsync->sync('/new/path/to/source', 'user@some.remote.lan:/abs/path/to/destination');
echo '/new/path/to/source ' . ($rsync->getExitCode() === 0 ? 'successfully synchronized with remote.' : 'not synchronised due to errors.') . "\n";

The Versions

20/07 2018

v1.0.3

1.0.3.0 https://github.com/xobotyi/rsync

rsync wrapper library for php

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anton Zinovyev

php rsync resync-wrapper

20/07 2018

dev-master

9999999-dev https://github.com/xobotyi/rsync

rsync wrapper library for php

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anton Zinovyev

php rsync resync-wrapper

29/06 2018

v1.0.2

1.0.2.0 https://github.com/xobotyi/rsync

rsync wrapper library for php

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anton Zinovyev

php rsync resync-wrapper

29/05 2018

v1.0.1

1.0.1.0 https://github.com/xobotyi/rsync

rsync wrapper library for php

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anton Zinovyev

php rsync resync-wrapper

20/04 2018

v1.0.0

1.0.0.0 https://github.com/xobotyi/rsync

rsync wrapper library for php

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anton Zinovyev

php rsync resync-wrapper

20/04 2018

v1.0.0-RC1

1.0.0.0-RC1 https://github.com/xobotyi/rsync

rsync wrapper library for php

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anton Zinovyev

php rsync resync-wrapper