PHPackages                             stickee/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. [Database &amp; ORM](/categories/database)
4. /
5. stickee/sync

ActiveLibrary[Database &amp; ORM](/categories/database)

stickee/sync
============

Stickee sync module - synchronise database tables

v3.1.1(1y ago)03.4k—0%proprietaryPHPPHP ^8.3

Since Aug 4Pushed 1y ago2 watchersCompare

[ Source](https://github.com/stickeeuk/sync-module)[ Packagist](https://packagist.org/packages/stickee/sync)[ Docs](https://www.stickee.co.uk)[ RSS](/packages/stickee-sync/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (19)Used By (0)

Stickee Sync
============

[](#stickee-sync)

This a composer module for synchronising files or database tables between two servers.

> NOTE: Foreign key checks are disabled during import

Installation
------------

[](#installation)

`composer require stickee/sync`

This module ships with a Laravel service provider which will be automatically registered.

### Manual registration

[](#manual-registration)

The module can be manually registered by adding this to the `providers` array in `config/app.php`:

```
\Stickee\Sync\ServiceProvider::class,

```

Usage for Servers (Sending Data)
================================

[](#usage-for-servers-sending-data)

Add the routes to your `routes/api.php` by calling `\Stickee\Sync\ServiceProvider::routes();`. You will usually want to prefix the URL and add some form of authentication, for example:

```
Route::middleware('auth:api')
    ->prefix('sync')
    ->name('sync.')
    ->group(function () {
        \Stickee\Sync\ServiceProvider::routes();
    });

```

Configuration
-------------

[](#configuration)

Run `php artisan vendor:publish --provider="Stickee\Sync\ServiceProvider"` to publish the configuration files, then fill in `tables` and `directories` in `sync-server.php`.

Usage for Clients (Receiving Data)
==================================

[](#usage-for-clients-receiving-data)

Configuration
-------------

[](#configuration-1)

Run `php artisan vendor:publish --provider="Stickee\Sync\ServiceProvider"` to publish the configuration files, then fill in `tables` and `directories` in `sync-client.php`. Set the following in your .env file:

- `SYNC_API_URL`: The server URL, e.g. `https://example.com/api/sync`

If you have added authentication, then you will need to make the Guzzle client authenticate. For api-token authenticaion, add this to you `config/sync-client.php`

```
'api_key' => env('SYNC_API_KEY'),

```

and add `SYNC_API_KEY=XXXXXXX` to your `.env` file.

Then in `AppServiceProvider::register()` add:

```
app()->when(\Stickee\Sync\Client::class)
    ->needs(\GuzzleHttp\Client::class)
    ->give(function () {
        $config = [
            'headers' => [
                'Authorization' => 'Bearer ' . \Stickee\Sync\Helpers::clientConfig('api_key'),
                'Accept' => 'application/json',
            ],
        ];

        return new \GuzzleHttp\Client($config);
    });

```

Commands
========

[](#commands)

The package supplies `php artisan sync:sync` to run a synchronisation from the command line.

Developing
==========

[](#developing)

The easiest way to make changes is to make the project you're importing the module in to load the module from your filesystem instead of the composer repository, like this:

1. `composer remove stickee/sync`
2. Edit `composer.json` and add ```
    "repositories": [
        {
            "type": "path",
            "url": "../sync"
        }
    ]

    ```

    where "../sync" is the path to where you have this project checked out
3. `composer require stickee/sync@dev`

**NOTE:** Do not check in your `composer.json` like this!

### Database tables

[](#database-tables)

Method 1:

- Client hashes its local copy of the table
- Client sends a getTableHash request to the server
- If the hashes are the same, there is nothing to do so stop
- Client sends a getTable request
- Client imports the response, which is merged in to the existing table

Method 2:

- Client hashes its local copy of the table
- Client sends a getTable request to the server, including the hash
- If the hashes are the same, the server will respond 304 Not Modified
- Client imports the response, which is merged in to the existing table

Tables can be hashed using a class that implements \\Stickee\\Sync\\Interfaces\\TableHasherInterface

### Files

[](#files)

- Client hashes its local copy of the files
- Client sends a getFileHashes request to the server
- Client compares the hashes and builds a list of files it needs to delete / download
- Client deletes extraneous files
- Client splits the list of files to fetch into chunks
- For each chunk, the client sends a getFiles request
- Files are saved to the disk

### Testing

[](#testing)

First copy `phpunit.xml.dist` to `phpunit.xml` and fill in your MySQL database details. Run unit tests with the following command:

` ./vendor/bin/phpunit -v`

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance45

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity78

Established project with proven stability

 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

Every ~105 days

Recently: every ~141 days

Total

17

Last Release

432d ago

Major Versions

0.0.2 → 1.0.02020-08-11

v1.0.5 → v2.0.02022-06-28

v2.0.2 → v3.0.02022-12-01

PHP version history (4 changes)1.0.1PHP ^7.2

v2.0.1PHP &gt;=7.2

v3.0.0PHP ^8.1

v3.1.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/48593081?v=4)[Greg Pinnington](/maintainers/stickeegreg)[@stickeegreg](https://github.com/stickeegreg)

---

Top Contributors

[![RoBorg](https://avatars.githubusercontent.com/u/702158?v=4)](https://github.com/RoBorg "RoBorg (28 commits)")[![stickeejamesn](https://avatars.githubusercontent.com/u/17043581?v=4)](https://github.com/stickeejamesn "stickeejamesn (14 commits)")[![stickeegreg](https://avatars.githubusercontent.com/u/48593081?v=4)](https://github.com/stickeegreg "stickeegreg (11 commits)")[![stickeeluke](https://avatars.githubusercontent.com/u/97950585?v=4)](https://github.com/stickeeluke "stickeeluke (7 commits)")[![stickeedavid](https://avatars.githubusercontent.com/u/41327792?v=4)](https://github.com/stickeedavid "stickeedavid (3 commits)")[![stickeepaul](https://avatars.githubusercontent.com/u/46900932?v=4)](https://github.com/stickeepaul "stickeepaul (3 commits)")[![ZebraNorth](https://avatars.githubusercontent.com/u/6115962?v=4)](https://github.com/ZebraNorth "ZebraNorth (1 commits)")

---

Tags

sync

### Embed Badge

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

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

###  Alternatives

[awssat/laravel-sync-migration

Laravel tool helps to sync migrations without refreshing the database

10923.2k](/packages/awssat-laravel-sync-migration)[korridor/laravel-has-many-sync

Laravel has many sync

3578.1k](/packages/korridor-laravel-has-many-sync)[kmi/db-sync-tool

Python script to synchronize a database from and to client systems.

323.5k](/packages/kmi-db-sync-tool)[illuminatech/sync-many-attribute

Allows control over Eloquent many-to-many relation via array attribute

156.7k](/packages/illuminatech-sync-many-attribute)[andreagroferreira/laravel-sync-tracker

A Laravel package for tracking entity synchronization status between systems

113.0k](/packages/andreagroferreira-laravel-sync-tracker)

PHPackages © 2026

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