PHPackages                             codeplayr/rsyncer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. codeplayr/rsyncer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

codeplayr/rsyncer
=================

Lightweigt rsync wrapper without dependencies

39PHP

Since Nov 16Pushed 9y ago1 watchersCompare

[ Source](https://github.com/codeplayr/rsyncer)[ Packagist](https://packagist.org/packages/codeplayr/rsyncer)[ RSS](/packages/codeplayr-rsyncer/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

### rsyncer

[](#rsyncer)

---

#### A thin rsync wrapper class for PHP without any dependencies

[](#a-thin-rsync-wrapper-class-for-php-without-any-dependencies)

##### Requirements

[](#requirements)

---

PHP 5.4+, rsync, composer

##### Installation

[](#installation)

---

- Use [Composer](https://getcomposer.org/doc/01-basic-usage.md) to install the package
- From project root directory execute

    `composer install`

    or

    `composer require codeplayr/rsyncer`
- [Composer](https://getcomposer.org/doc/01-basic-usage.md) will take care of autoloading. Just include the autoloader at the top of the file

    `require_once __DIR__ . '/vendor/autoload.php';`

##### Usage

[](#usage)

---

See following example:

```
use \Codeplayr\Rsyncer\Option;
use \Codeplayr\Rsyncer\SSH;
use \Codeplayr\Rsyncer\Rsync;

$source = __DIR__ . '/src/';
$destination = __DIR__ . '/backup/';

$date = date('Y-m-d', time());

//rsync options
$option = new Option([
	Option::FILES_FROM	=> __DIR__ . '/rules.txt',
	Option::EXCLUDE_FROM=> __DIR__ . '/exclude-rules.txt',
	Option::LOG_FILE	=> __DIR__ . "/logs/{$date}.log",
	Option::ARCHIVE		=> false,
	Option::LINKS		=> true,
	Option::TIMES		=> true,
	Option::RECURSIVE	=> true,
	Option::VERBOSE		=> true,
	Option::COMPRESS	=> true,
	Option::CHECKSUM	=> true,
	Option::DRY_RUN		=> false,
]);

//add additional flags
$option->addFlag('human-readable')
		->addArgument('exclude', '/path/to/exclude')
		->addArgument('include', '*.html')
		->addArgument('include', '*.php')
		->addArgument('include', '*/')
		->addArgument('exclude', '*');

//optional ssh connection to remote host
$ssh = new SSH([
	SSH::USERNAME		=> 'root',
	SSH::HOST			=> '1.2.3.4',
	SSH::PORT			=> 22,
	SSH::IDENTITY_FILE	=> '/path/to/private/key',
]);

//configuration options
$conf = [
	Rsync::SHOW_OUTPUT	=> true,
];

$rsnyc = new Rsync( $option, $ssh, $conf );

//assemble and show Command
echo $rsnyc->getCommand( $source, $destination );

//start syncing directories
if( ! $rsnyc->sync( $source, $destination ) ){
	echo $rsnyc->getMessage()->toString();
}
```

Running the script generates following rsync command and options:

```
rsync
	-ltrvzc
	--human-readable
	--files-from="/path/to/rules.txt"
	--exclude-from="/path/to/exclude-rules.txt"
	--log-file="/path/to/logs/2016-10-29.log"
	--exclude='/path/to/exclude'
	--include="*.html"
	--include="*.php"
	--include="*/"
	--exclude="*"
	-e="ssh -i /path/to/your/private/key"
	root@1.2.3.4:"/path/to/src/" "/path/to/backup/"
```

##### Run Tests:

[](#run-tests)

---

- All tests are inside `tests` folder.
- Execute `composer install --dev phpunit/phpunit` to install phpunit
- Run `phpunit` from inside the tests directory to execute testcase
- Set `--coverage-text` option to show code coverage report in terminal

##### Notes:

[](#notes)

---

If you like this script or have some features to add: contact me, fork this project, send pull requests, you know how it works.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3151430?v=4)[Lucas](/maintainers/codeplayr)[@codeplayr](https://github.com/codeplayr)

---

Top Contributors

[![codeplayr](https://avatars.githubusercontent.com/u/3151430?v=4)](https://github.com/codeplayr "codeplayr (14 commits)")

### Embed Badge

![Health badge](/badges/codeplayr-rsyncer/health.svg)

```
[![Health](https://phpackages.com/badges/codeplayr-rsyncer/health.svg)](https://phpackages.com/packages/codeplayr-rsyncer)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
