PHPackages                             appiersign/realtime-model - 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. appiersign/realtime-model

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

appiersign/realtime-model
=========================

This package enables syncing laravel models with Google Firestore

v1.0.4(3y ago)0382MITPHPPHP &gt;=7.4

Since Aug 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/appiersign/realtime-model)[ Packagist](https://packagist.org/packages/appiersign/realtime-model)[ RSS](/packages/appiersign-realtime-model/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

Realtime Model
==============

[](#realtime-model)

This package enables you to sync laravel models with Google Cloud Firestore. This packages works with an internally developed API that uses the gprc PHP extension to seamlessly connect your PHP backend to Firestore.

### Installation

[](#installation)

`composer require appiersign/realtime-model`

### Set Up

[](#set-up)

Set these params in your .env file:

```
    ...
    FIRESTORE_SERVER_URI=
    API_GATEWAY_TOKEN=
    ...

```

### Configuration

[](#configuration)

Add the realtime model service provider 'providers' array in your `config/app.php` file.

\[
...
`AppierSign\RealtimeModel\Providers\RealtimeModelServiceProvider::class`

\]

Add `"AppierSign\\RealtimeModel\\": "vendor/appiersign/realtime-model/src"` to the `autoload.psr-4` object in your `composer.json` file

### Usage

[](#usage)

To automatically sync data to firestore, just add the `RealtimeModel` trait to the desired model. This will automatically sync all model attributes to Firestore whenever a new model is created or updated.

You can also use the realtime artisan command to sync all data associated with a model:

```
    php artisan realtime:sync User

```

To define which fields or attributes to sync, define the `toRealtimeData()` public method on the model like this:

```
public function toRealtimeData(): array
{
    return [
        'externalId' => $this->external_id,
        'fullName' => $this->full_name,
        'phone' => $this->phone,
        'username' => $this->username
    ];
}

```

#### Setting Key

[](#setting-key)

To set the id or primary/unique key for the model, override the `getSyncKey()` public method on the model like this:

```
public function getSyncKey(): string
{
    return 'externalId';
}

```

The package uses the plural form of the model name as the suffix of the collection name to change this, override the `collection()` public method on the model like this:

```
public function collection(): string
{
    return 'premium_users';
}

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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 ~2 days

Total

5

Last Release

1369d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/93f196f9a6f90c9ebed3f4dd30f6e8779309753a78d278ccaf2ec9375e95df5e?d=identicon)[appiersign](/maintainers/appiersign)

---

Top Contributors

[![appiersign](https://avatars.githubusercontent.com/u/18679564?v=4)](https://github.com/appiersign "appiersign (17 commits)")

### Embed Badge

![Health badge](/badges/appiersign-realtime-model/health.svg)

```
[![Health](https://phpackages.com/badges/appiersign-realtime-model/health.svg)](https://phpackages.com/packages/appiersign-realtime-model)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[matanyadaev/laravel-eloquent-spatial

Spatial library for Laravel

3982.9M15](/packages/matanyadaev-laravel-eloquent-spatial)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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