PHPackages                             vashkatsi/folders-sync - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. vashkatsi/folders-sync

ActiveLibrary[File &amp; Storage](/categories/file-storage)

vashkatsi/folders-sync
======================

Sync directory contents over HTTP using PHP

1.0-beta(12y ago)221MITPHPPHP &gt;=5.3.0

Since May 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Vashkatsi/folders-sync)[ Packagist](https://packagist.org/packages/vashkatsi/folders-sync)[ RSS](/packages/vashkatsi-folders-sync/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Sync directory contents over HTTP using PHP
===========================================

[](#sync-directory-contents-over-http-using-php)

PHP 7.1 code refactored

Use these classes to recursively sync the contents of two folders on different servers. The source must have a web server although the directory being synced does not have to be web accessible. The client initiates the connection and can be either another web server or a command line script.

Install
-------

[](#install)

If using Composer, add `"vashkatsi/folders-sync":"1.*@dev"` to your requirements.

Otherwise, just download and `require` the classes as normal.

How it works
------------

[](#how-it-works)

1. Client collects list of existing files in destination folder (and subfolders), with size and modified dates
2. Client POSTs list to the server
3. Server gets list of files in source folder on server and compares this with list of files from client
4. Server returns list of new or modified files present on server
5. Client requests contents of each new or modified file and saves it to destination folder
6. Client sets last modified time of file to match server

No attempt is made to send diffs; this is not rsync. Symlinks are not explicitly supported. All communication is via JSON data in the request/response body.

Example
-------

[](#example)

On the server, e.g. `example.com/remote.php`:

```
require_once 'vendor/autoload.php'; //or include AbstractSync.php and Server.php

const SECRET = '5ecR3t'; //make this long and complicated
const PATH = '/path/to/source'; //sync all files and folders below this path

$server = new \Vashkatsi\Sync\Server(SECRET, PATH);
$server->run(); //process the request
```

On the client(s):

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

const SECRET = '5ecR3t'; //this must match the secret key on the server
const PATH = '/path/to/destination'; //target for files synced from server

$client = new \Vashkatsi\Sync\Client(SECRET, PATH);
$client->run('http://example.com/remote.php'); //connect to server and start sync
```

FAQ
---

[](#faq)

### Why not just use rsync?

[](#why-not-just-use-rsync)

Sometimes you need code to be portable across a range of hosting environments so you can't rely on rsync, scp or other external dependencies.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4733d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7134b47e29d0bee582c66534d1f17a14ad6e5af1df823de651ed1933c5f898e?d=identicon)[vashkatsi](/maintainers/vashkatsi)

---

Top Contributors

[![tamlyn](https://avatars.githubusercontent.com/u/115310?v=4)](https://github.com/tamlyn "tamlyn (8 commits)")[![Vashkatsi](https://avatars.githubusercontent.com/u/2290581?v=4)](https://github.com/Vashkatsi "Vashkatsi (8 commits)")[![PeterNotenboom](https://avatars.githubusercontent.com/u/8448364?v=4)](https://github.com/PeterNotenboom "PeterNotenboom (2 commits)")

### Embed Badge

![Health badge](/badges/vashkatsi-folders-sync/health.svg)

```
[![Health](https://phpackages.com/badges/vashkatsi-folders-sync/health.svg)](https://phpackages.com/packages/vashkatsi-folders-sync)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M123](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M61](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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