PHPackages                             sqlsync/laravel-sqlsync - 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. sqlsync/laravel-sqlsync

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

sqlsync/laravel-sqlsync
=======================

Laravel package to receive and serve data from SqlSync Windows Agent

v1.10.0(2w ago)03321MITPHPPHP ^8.2

Since Jun 15Pushed 2w agoCompare

[ Source](https://github.com/fenixthelord/sqlsync-package)[ Packagist](https://packagist.org/packages/sqlsync/laravel-sqlsync)[ RSS](/packages/sqlsync-laravel-sqlsync/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (9)Versions (32)Used By (1)

SqlSync — Laravel Package
=========================

[](#sqlsync--laravel-package)

**`sqlsync/laravel-sqlsync`**

Drop-in Laravel package that bridges the SqlSync Windows Agent to any Laravel application. Receives synced data from local accounting software (Al-Ameen, Al-Bayan) and exposes it via a clean REST API for mobile apps.

---

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 10, 11, or 12

---

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

[](#installation)

```
composer require sqlsync/laravel-sqlsync
php artisan sqlsync:install
```

Add to `.env`:

```
SQLSYNC_AGENT_SECRET=your-strong-secret-here
SQLSYNC_MULTI_TENANT=false
```

---

Endpoints
---------

[](#endpoints)

### Agent → Backend (authenticated by HMAC)

[](#agent--backend-authenticated-by-hmac)

MethodURLDescriptionPOST`/sqlsync/agent/sync`Receive a sync batchPOST`/sqlsync/agent/heartbeat`Agent heartbeat pingGET`/sqlsync/agent/logs`Sync logs for this agent**Required headers from Agent:**

```
X-Agent-ID:    {machine-fingerprint}
X-Agent-Token: {hmac-sha256-signature}
X-Timestamp:   {unix-timestamp}

```

**Payload:**

```
{
  "preset": "al_ameen",
  "company_id": 1,
  "records": [ { "guid": "...", "name": "...", ... } ]
}
```

---

### Mobile API (React Native)

[](#mobile-api-react-native)

MethodURLDescriptionGET`/sqlsync/api/v1/records`List records (paginated)GET`/sqlsync/api/v1/records/{guid}`Single recordGET`/sqlsync/api/v1/stats`Dashboard stats**Query parameters:**

- `preset` — filter by preset (`al_ameen`, `al_bayan`)
- `search` — search by name, barcode, or code
- `company_id` — required when multi-tenant is enabled
- `per_page` — items per page (default: 20)

---

Supported Presets
-----------------

[](#supported-presets)

KeySoftware`al_ameen`Al-Ameen (الأمين) — maps from `vwMtPrices``al_bayan`Al-Bayan (البيان) — maps from `MatCard` + `Barcode` (joined by `Num`)> **Note on Al-Bayan pricing:** Al-Bayan exposes generic `Price1`–`Price35` columns whose meaning (retail, wholesale, etc.) is configured per business *inside* Al-Bayan itself — it isn't fixed. The preset passes every price column through into `extra_data` as-is; each installation then picks the right one from **Filament → SqlSync → Product Bridge → Field Mapping**. Don't hardcode a "the retail price" assumption for Al-Bayan.

---

Custom Presets
--------------

[](#custom-presets)

Implement `PresetContract` and register in config:

```
// config/sqlsync.php
'presets' => [
    'my_software' => \App\SqlSync\MyPreset::class,
],
```

```
class MyPreset implements \SqlSync\LaravelSqlSync\Contracts\PresetContract
{
    public function map(array $raw): array
    {
        return [
            'source_guid' => $raw['id'],
            'name'        => $raw['product_name'],
            'extra_data'  => ['price' => $raw['price']],
        ];
    }
}
```

---

Product Bridge
--------------

[](#product-bridge)

The package never writes to your app's own `products` table directly — every project has a different schema. Instead, `SyncedRecordBridgeObserver` (auto-registered, nothing to wire up) reads a `BridgeSetting` row configured visually from **Filament → SqlSync → Product Bridge**:

- **Target model** — your own `App\Models\Product` (or anything else)
- **Match column** — e.g. `barcode` (synced record) ↔ `sku` (your table)
- **Field mapping** — any column on your table ↔ any field on the synced record (dot notation into `extra_data` supported, e.g. `extra_data.price_4`)
- **Auto-category** — find-or-create a category from a synced field (e.g. `group_name`), so a required `category_id` never blocks product creation
- **Bridge Activity log** (`sqlsync_bridge_logs`) — every decision (created / updated / skipped + reason) is recorded and browsable from Filament

### Re-applying the bridge to already-synced data

[](#re-applying-the-bridge-to-already-synced-data)

If you change the Bridge mapping *after* records have already synced, existing rows won't automatically re-trigger (especially with incremental/`SinceColumn` syncing). Two ways to force a re-run:

```
# CLI — no execution time limit, best for large catalogs, for developers only
php artisan sqlsync:reapply-bridge
```

Or click **"إعادة تطبيق الربط على كل السجلات"** in Filament, which dispatches `ReapplyBridgeJob` to your queue (requires `QUEUE_CONNECTION=database` + a cron running `queue:work` — see `TROUBLESHOOTING.md`) so non-technical users never need a terminal.

---

This package is **API-only**. For an admin UI, install the optional Filament plugin:

```
composer require sqlsync/laravel-sqlsync-filament
php artisan sqlsync-filament:install
```

---

Multi-Tenancy
-------------

[](#multi-tenancy)

Enable in `.env`:

```
SQLSYNC_MULTI_TENANT=true
```

Every request must include `company_id`. All data is isolated per company automatically.

---

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

[](#configuration)

Publish and edit:

```
php artisan vendor:publish --tag=sqlsync-config
```

```
// config/sqlsync.php
return [
    'agent' => [
        'secret'              => env('SQLSYNC_AGENT_SECRET'),
        'timestamp_tolerance' => 300, // seconds
    ],
    'multi_tenant' => false,
    'routes' => [
        'prefix'       => 'sqlsync',
        'middleware'   => ['api'],
        'agent_prefix' => 'agent',
        'api_prefix'   => 'api/v1',
    ],
    'sync' => [
        'log_enabled'        => true,
        'log_retention_days' => 30,
        'batch_size'         => 500,
    ],
];
```

---

---

Troubleshooting
---------------

[](#troubleshooting)

Common real-world issues (Opcache on shared hosting, WinForms quirks, mismatched preset columns, duplicate barcodes, etc.) are documented in **[`TROUBLESHOOTING.md`](./TROUBLESHOOTING.md)**.

Full docs (with screenshots and a step-by-step quick start): see the SqlSync website `docs/` folder.

---

Developer
---------

[](#developer)

**محمد خلف · +963945235962**

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance97

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% 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 ~1 days

Total

31

Last Release

16d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e58b5b78540441e8aa5b4c953b33f54d699e7ffa7eaf3aae6f1c1a1633118d7?d=identicon)[DextePHP](/maintainers/DextePHP)

---

Top Contributors

[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (20 commits)")[![fenixthelord](https://avatars.githubusercontent.com/u/7693624?v=4)](https://github.com/fenixthelord "fenixthelord (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sqlsync-laravel-sqlsync/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M348](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k21](/packages/fleetbase-core-api)

PHPackages © 2026

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