Download the PHP package hub-io/laravel-hubio-sync without Composer

On this page you can find all versions of the php package hub-io/laravel-hubio-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-hubio-sync

Laravel Hubio Sync

Latest Version on Packagist Total Downloads

Offline-first backup, sharing and photo synchronization for NativePHP Mobile apps through the Hubio.Space sync API (api/sync/v1/{app}).

The app keeps working on its local SQLite database. In the background the device registers anonymously (its personal household is the backup), can create or join family / work households with an invite code, and exchanges changed rows with the server: pending rows, photos and deletions go up, rows changed by other devices come down. The newest change of a row wins on both sides.

Support us

We invest a lot of time and give our hearts to work in Open Source.

Requirements

Installation

You can install the package via composer:

The migrations (households, sync_tombstones, sync_files) are loaded automatically:

You can publish the config file with:

This is the content of the published config file:

Set the API URL of your app in .env. An empty URL turns synchronization off and the app works offline only:

Usage

Make a model syncable

The table needs a uuid column, a synced_at string column and timestamps. Timestamps keep milliseconds (the newest change wins); a row whose updated_at differs from synced_at is pending upload, and a deleted row leaves a tombstone.

Register it in config/hubio-sync.php, referenced rows first:

Optional hooks on the model:

Method Purpose
syncHouseholds(): array Households the row belongs to (defaults to the personal backup).
syncDependencies(): array Rows that must reach the same shared household (e.g. an item's product).
syncFiles(): array Payload keys holding photos => column with the path on the files disk.
static syncExisting(array $attributes): ?int Local row a downloaded record with a new UUID merges into.
static syncApplied(int $id, array $data, Household $household): void Writes child rows of a downloaded record (use the query builder).

Synchronize

Saving or deleting a syncable model starts a background sync shortly after (bursts of changes start one task). While a screen is open, poll periodically:

Or run it in the foreground:

The status is one of disabled, offline, failed or synced. SyncClient::state() returns the last sync time and error.

Households

Shares

Publish a record under a code for everyone using the same app; others open it and rate it with 1–5 stars:

Push-triggered sync

With nativephp/mobile-firebase, the push token is sent to the server automatically. When a household changes, Hubio.Space sends a silent data message with the event Hubio\Sync\Events\SyncRequested, which runs a sync, also while the app is in the background.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-hubio-sync with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^13.0
nativephp/mobile Version ^4.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hub-io/laravel-hubio-sync contains the following files

Loading the files please wait ...