PHPackages                             sdecalom/sync-sftp - 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. sdecalom/sync-sftp

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

sdecalom/sync-sftp
==================

Sync local files with ftp server

02PHP

Since Dec 23Pushed 4y agoCompare

[ Source](https://github.com/sdecalom/php-sync-sftp)[ Packagist](https://packagist.org/packages/sdecalom/sync-sftp)[ RSS](/packages/sdecalom-sync-sftp/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

php-sync-sftp
=============

[](#php-sync-sftp)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3194815d6fd436901f176b921aba76e0f9bff1b0ec722d04fde184d11fb66b10/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656d6d616e75656c726f65636b65722f7068702d73796e632d736674702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/emmanuelroecker/php-sync-sftp/?branch=master)[![Build Status](https://camo.githubusercontent.com/4fc52cbe95ddc16d9afed1e1b9da396e7c1e7058fc25278b48809ec4aa118b0c/68747470733a2f2f7472617669732d63692e6f72672f656d6d616e75656c726f65636b65722f7068702d73796e632d736674702e737667)](https://travis-ci.org/emmanuelroecker/php-sync-sftp)[![Coverage Status](https://camo.githubusercontent.com/caff9b5e64fe4d57dd8d248165d67f79e5bac37738213cc69aa8b73104320727/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f656d6d616e75656c726f65636b65722f7068702d73796e632d736674702f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/emmanuelroecker/php-sync-sftp?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/63cd238e7f77d25ecd5c7b4ad298cf9d042fd943b7b97b67c55a1ee151aafde7/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f31313436323738352d643365612d346365352d613165662d6538373037393963656231332f6d696e692e706e67)](https://insight.sensiolabs.com/projects/11462785-d3ea-4ce5-a1ef-e870799ceb13)[![Dependency Status](https://camo.githubusercontent.com/ad4b055df8dfea0eb311b2e3d03923325541155fda2131e714683605bcf2fc8c/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537633137326430393638643634303034396531323139352f62616467652e7376673f7374796c653d666c61742d737175617265)](https://www.versioneye.com/user/projects/57c172d0968d640049e12195)

Synchronize local files with sftp (ssh ftp) server.

Compare dates between local and remote files, not using crc.(cyclic redundancy check), and update files only on remote sftp server.

Installation SFTP 2
-------------------

[](#installation-sftp-2)

This library can be found on [Packagist](https://packagist.org/packages/sdecalom/sync-sftp).

The recommended way to install is through [composer](http://getcomposer.org).

Edit your `composer.json` and add:

```
{
    "require": {
       "sdecalom/sync-sftp": "dev-master"
    },
    "prefer-stable": true,
    "minimum-stability": "dev"
}
```

And install dependencies:

```
php composer.phar install
```

Example
-------

[](#example)

```
// Must point to composer's autoload file.
require 'vendor/autoload.php';

use GlSyncFtp\GlSyncFtp;

//init connection informations
$ftp = new GlSyncFtp("192.168.0.1", 22, "username", "password");

//launch synchronisation between local directory and remote files
$ftp->syncDirectory(
    "/home/user/localDirectory", //local source directory
        "/host/web/remoteDirectory", //remote destination directory
        function ($op, $path) {
            switch ($op) {
                case GlSyncFtp::CREATE_DIR:
                    echo "Create Directory : ";
                    break;
                case GlSyncFtp::DELETE_DIR:
                    echo "Delete Directory : ";
                    break;
                case GlSyncFtp::DELETE_FILE:
                    echo "Delete File : ";
                    break;
                case GlSyncFtp::UPDATE_FILE:
                    echo "Update File : ";
                    break;
                case GlSyncFtp::NEW_FILE:
                    echo "New File : ";
                    break;
                default:
            }
            echo $path . "\n";
        }
);

//launch synchronisation between list of local directories and remote directories
$fps->syncDirectories(
    [
        "/home/user/localDirectory1" => "/host/web/remoteDirectory1",
        "/home/user/localDirectory2" => "/host/web/remoteDirectory2"
    ],
        function ($src, $dst) {
            echo "Sync directory : $src with $dst";
        },
        function ($op, $path) {
            switch ($op) {
                case
                GlSyncFtp::CREATE_DIR:
                    echo "Create Directory : ";
                    break;
                case GlSyncFtp::DELETE_DIR:
                    echo "Delete Directory : ";
                    break;
                case GlSyncFtp::DELETE_FILE:
                    echo "Delete File : ";
                    break;
                case GlSyncFtp::UPDATE_FILE:
                    echo "Update File : ";
                    break;
                case GlSyncFtp::NEW_FILE:
                    echo "New File : ";
                    break;
                default:
            }
            echo $path . "\n";
        }
);
```

Running Tests
-------------

[](#running-tests)

Local ssh ftp server must be installed (On Windows, you can use cygwin openssh)

With [Docker](http://www.docker.com/) :

```
(cd docker ; sudo tar xpvzf docker.tar.gz)
docker pull rhasselbaum/scrappy-sftp
docker run -d --name sftp -p 2022:22 -v /$(pwd)/docker/sftp-root:/sftp-root -v /$(pwd)/docker/credentials:/creds rhasselbaum/scrappy-sftp
```

Launch from command line :

```
vendor\bin\phpunit
```

Change ftp server config in file : phpunit.xml.dist

License MIT
-----------

[](#license-mit)

Contact
-------

[](#contact)

Authors : Emmanuel ROECKER &amp; Rym BOUCHAGOUR &amp; Sebastien

[Web Development Blog - http://dev.glicer.com](http://dev.glicer.com)

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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://www.gravatar.com/avatar/57b71a47f56cb6ff9513d705f1e152f97c3331d48fc494af6d65e77ba8c1a17c?d=identicon)[sdecalom](/maintainers/sdecalom)

---

Top Contributors

[![sdecalom](https://avatars.githubusercontent.com/u/3275377?v=4)](https://github.com/sdecalom "sdecalom (6 commits)")

### Embed Badge

![Health badge](/badges/sdecalom-sync-sftp/health.svg)

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

###  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.8M124](/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.7M62](/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)
