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 today

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 35% 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

1422d 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

11223.5M33](/packages/anourvalar-eloquent-serialize)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)

PHPackages © 2026

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