PHPackages                             jamielsharief/file-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. jamielsharief/file-sync

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

jamielsharief/file-sync
=======================

A HTTP based file synchronization library that uses public key authentication

0.1.1(5y ago)141MITPHPPHP &gt;=7.3.0

Since Nov 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jamielsharief/file-sync)[ Packagist](https://packagist.org/packages/jamielsharief/file-sync)[ RSS](/packages/jamielsharief-file-sync/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (3)Used By (0)

File Sync (beta)
================

[](#file-sync-beta)

[![license](https://camo.githubusercontent.com/6fdb99389fe9d9e8a5c197002a191ace7c8b12a2020c0fa5756cf17aa08a4966/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874477265656e2e737667)](https://camo.githubusercontent.com/6fdb99389fe9d9e8a5c197002a191ace7c8b12a2020c0fa5756cf17aa08a4966/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874477265656e2e737667)[![Build Status](https://camo.githubusercontent.com/d0cfaae5d5b5930c66a93804ce916fea7b7fd03da6c0c6cf7a84427af21fd682/68747470733a2f2f7472617669732d63692e636f6d2f6a616d69656c736861726965662f66696c652d73796e632e7376673f6272616e63683d6d61696e)](https://travis-ci.com/jamielsharief/file-sync)[![Coverage Status](https://camo.githubusercontent.com/8a56b931249b42502463f1e2c32c583ec806bb728437034c4e3d5c0fa9d2ccc2/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6a616d69656c736861726965662f66696c652d73796e632f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/jamielsharief/file-sync?branch=main)

A HTTP based file synchronization library that uses public key authentication.

This library can be used to install or update applications from private sources, sync data files or for any other reason that you can think of where you might want `rsync` functionality but to be able to control it using PHP easily.

Setup
-----

[](#setup)

Create the script on the remote server e.g. `sync.php` on the server, that `Client` will communicate with.

```
use FileSync\Server;
$server = new Server(__DIR__ . '/storage/keys');
$server->dispatch('/server/data');
```

Call the `Client` `dispatch` method from a script or your application

```
use FileSync\Client;
$client = new Client(__DIR__ . '/storage/keys');
$client->dispatch('https://localhost:8000/sync.php','demo@example.com','/var/www/app.example.com/public_html');
```

Generating Key Pairs
--------------------

[](#generating-key-pairs)

`FileSync` looks for keys using the extension based upon type of key that it needs e.g. `.privateKey` and `.publicKey`.

You need to generate a `private` key and save this on the client machine, save the `public` key on the server in the keychain folder when you are creating instances.

### PHP

[](#php)

`FileSync` uses the [jamielsharief/encryption](https://github.com/jamielsharief/encryption) library for encryption and decryption.

To generate a key pair

```
use Encryption\Keypair;
$keyPair = KeyPair::generate();
echo $keyPair->privateKey();
echo $keyPair->publicKey();
```

To generate a private key only

```
use Encryption\PrivateKey;
$privateKey = PrivateKey::generate();
```

To work with private or public keys

```
$publicKey = PublicKey::load($pathToKey);
$privateKey = PrivateKey::load($pathToKey);
```

See [jamielsharief/encryption](https://github.com/jamielsharief/encryption) for more information.

### Command Line

[](#command-line)

To generate a `private` key and save this to a file

```
$ openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out demo@example.com.privateKey
```

To generate a `public` key from the `private` key

```
$ openssl rsa -in demo@example.com.privateKey -pubout > demo@example.com.publicKey
```

Ignoring Files
--------------

[](#ignoring-files)

> You should NEVER sync a folder that contains private data with other people.

To ignore files on either the client or server just create a `.syncignore` file.

Here is an example show how to exclude single files, files with an extension or complete folders

```
version.txt
config/details.conf
*.json
vendor/
```

Demo
----

[](#demo)

To load the demo, first start the built in PHP web server

```
$ php -S localhost:8000
```

Then run the following command, this will create a folder called `dest` and sync the files from `src`.

```
$ php demo.php
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

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.

###  Release Activity

Cadence

Every ~10 days

Total

2

Last Release

1998d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7718a059aa8ef3d6e9f6e5bd7f4d5b09b7321a059f2669e61546d1a665fbb372?d=identicon)[jamielsharief](/maintainers/jamielsharief)

---

Top Contributors

[![jamielsharief](https://avatars.githubusercontent.com/u/20553479?v=4)](https://github.com/jamielsharief "jamielsharief (28 commits)")

---

Tags

filehttppublic-key-authenticationsyncfilesystemsync

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jamielsharief-file-sync/health.svg)

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

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k639.1M2.2k](/packages/league-flysystem)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[knplabs/knp-gaufrette-bundle

Allows to easily use the Gaufrette library in a Symfony project

72528.6M91](/packages/knplabs-knp-gaufrette-bundle)[league/flysystem-local

Local filesystem adapter for Flysystem.

226231.8M39](/packages/league-flysystem-local)[oneup/flysystem-bundle

Integrates Flysystem filesystem abstraction library to your Symfony project.

64422.9M66](/packages/oneup-flysystem-bundle)

PHPackages © 2026

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