PHPackages                             pushinbr/pam-native-nitro - 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. [Caching](/categories/caching)
4. /
5. pushinbr/pam-native-nitro

Active[Caching](/categories/caching)

pushinbr/pam-native-nitro
=========================

00PHPCI passing

Pushed todayCompare

[ Source](https://github.com/push-in/pam-native-nitro)[ Packagist](https://packagist.org/packages/pushinbr/pam-native-nitro)[ RSS](/packages/pushinbr-pam-native-nitro/feed)WikiDiscussions main Synced today

READMEChangelog (2)DependenciesVersionsUsed By (0)

PAM Native Nitro
================

[](#pam-native-nitro)

**Offline-first data at native speed.**

PAM Native Nitro is the high-performance local data engine for PAM Native. It keeps application startup independent from database size by querying lazily on a native worker and materializing only the records a screen needs.

> Performance claims in this project are backed by reproducible benchmarks. The engineering target is to outperform JSON cache hydration by at least 10× in representative mobile workloads.

Design
------

[](#design)

- Native SQLite on Android and iOS.
- WAL and prepared-statement optimizations in the PAM runtime.
- Lazy models: no full-database hydration.
- Bounded, indexed, paginated queries.
- Integer-backed enums for coded domain values.
- Additive schema evolution without dropping cached rows.
- No reflection in hot query paths; schemas are reflected once and cached.
- No JavaScript, JSI, ORM proxies, or runtime code generation.

WatermelonDB demonstrated the right mobile principle: keep queries native, lazy, asynchronous, and observable. PAM Native Nitro applies that principle to PAM's persistent PHP runtime with fewer transport layers.

Read the [architecture](docs/architecture.md) and [benchmark protocol](docs/benchmarks.md) before evaluating performance claims.

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

[](#installation)

```
composer require pushinbr/pam-native-nitro
```

PAM Native Nitro 0.1 requires PAM Native 0.5.4 or newer.

Models
------

[](#models)

```
use Pam\Nitro\Attributes\Field;
use Pam\Nitro\Attributes\Children;
use Pam\Nitro\Attributes\PrimaryKey;
use Pam\Nitro\Model;
use Pam\Nitro\Relations\ChildrenRelation;

enum MessageType: int
{
    case Text = 1;
    case Image = 2;
}

final class Message extends Model
{
    #[PrimaryKey]
    #[Field]
    public string $id;

    #[Field(indexed: true)]
    public string $chatId;

    #[Field]
    public string $body;

    #[Field]
    public MessageType $type;

    #[Field(indexed: true)]
    public int $createdAt;

    public static function table(): string
    {
        return 'messages';
    }
}
```

Relations are declared once and stay lazy:

```
final class Chat extends Model
{
    #[PrimaryKey]
    #[Field]
    public string $id;

    #[Children(Message::class, foreignKey: 'chat_id')]
    public ChildrenRelation $messages;

    public static function table(): string
    {
        return 'chats';
    }
}

$chat->messages->get(function (array $messages): void {
    // Only this chat's rows cross the native boundary.
});
```

Use
---

[](#use)

```
use Pam\Nitro\Nitro;

Nitro::boot('zechat.db');
Nitro::prepare([Message::class], function () use ($chatId): void {
    Message::query()
        ->where('chat_id', $chatId)
        ->latest()
        ->limit(20)
        ->get(function (array $messages): void {
            $this->messages = array_reverse($messages);
        });
});

Nitro::saveMany($messages, function (): void {
    // Thousands of upserts, one bridge call, one prepared statement,
    // one native transaction.
});
```

Schema evolution
----------------

[](#schema-evolution)

`Nitro::prepare()` reconciles newly declared fields with an existing table. Missing columns are added sequentially on the native SQLite worker, preserving all cached rows. Give a new non-nullable property a domain-safe default:

```
#[Field]
public string $preview = '';
```

Older rows hydrate with that default immediately. Nullable fields migrate to `NULL`; integer-backed enums use the first sequential case when no explicit property default exists. Destructive renames and type changes remain explicit application migrations.

Status
------

[](#status)

PAM Native Nitro is under active development. The initial API is intentionally small while the binary bridge, batch writes, observation, destructive migrations, relations, and benchmarks are hardened.

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity8

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19325395?v=4)[David William balbino](/maintainers/DavidWilliamBalbino)[@DavidWilliamBalbino](https://github.com/DavidWilliamBalbino)

---

Top Contributors

[![DavidWilliamBalbino](https://avatars.githubusercontent.com/u/19325395?v=4)](https://github.com/DavidWilliamBalbino "DavidWilliamBalbino (5 commits)")

---

Tags

androidcacheiosmobile-databaseoffline-firstpampam-nativephpsqlite

### Embed Badge

![Health badge](/badges/pushinbr-pam-native-nitro/health.svg)

```
[![Health](https://phpackages.com/badges/pushinbr-pam-native-nitro/health.svg)](https://phpackages.com/packages/pushinbr-pam-native-nitro)
```

PHPackages © 2026

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