PHPackages                             fatlum/nativephp-push - 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. fatlum/nativephp-push

ActiveNativephp-plugin

fatlum/nativephp-push
=====================

Free FCM/APNs push notifications for NativePHP Mobile — the native layer that the paid nativephp/mobile-firebase plugin charges for, wired into the existing (MIT) core PHP API.

0.1.3(1mo ago)297↓25%2[2 PRs](https://github.com/FatlumGjinofci/nativephp-push/pulls)MITPHPPHP ^8.2CI passing

Since Jun 25Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/FatlumGjinofci/nativephp-push)[ Packagist](https://packagist.org/packages/fatlum/nativephp-push)[ Docs](https://github.com/FatlumGjinofci/nativephp-push)[ RSS](/packages/fatlum-nativephp-push/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

fatlum/nativephp-push
=====================

[](#fatlumnativephp-push)

A **free**, MIT-licensed plugin.

It implements only the part that actually costs money — the **native Swift/Kotlin layer** — and wires it into the push API that already ships in NativePHP Mobile's open-source core. Firebase Cloud Messaging and APNs are free; this is the glue.

How it fits together
--------------------

[](#how-it-fits-together)

The PHP API, the `TokenGenerated` event, and the on-device event-dispatch route all live in core (`nativephp/mobile`, MIT) already. This plugin supplies the native implementations core calls:

LayerWhere it lives`PushNotifications::enroll() / checkPermission() / getToken()`**core** (`Native\Mobile\Facades\PushNotifications`)`TokenGenerated` event, `POST /_native/api/events` route**core**Ephemeral PHP runtime for background execution**core** (v3.2+)Native bridge functions `PushNotification.*`, Firebase SDK, FCM service**this plugin**Server-side FCM v1 sender**this plugin**> **Do not install this alongside `nativephp/mobile-firebase`.** Both register the same `PushNotification.*` bridge functions — pick one.

What's implemented
------------------

[](#whats-implemented)

- Permission flow + token delivery (`TokenGenerated` fires with `token` + enrollment `id`)
- **Background data-message processing** — when the app is backgrounded or killed, the FCM service boots core's ephemeral PHP runtime and dispatches your event via the `native:push:dispatch`artisan command. Foreground messages go through the live web view so mounted Livewire components react.
- Deep-link / data handling, badge clearing
- Free server-side sending via the FCM v1 API

---

Install
-------

[](#install)

```
// app composer.json
{ "repositories": [ { "type": "path", "url": "../packages/nativephp-push" } ] }
```

```
composer require fatlum/nativephp-push
php artisan native:plugin:register fatlum/nativephp-push
php artisan vendor:publish --tag=native-push-config   # optional
```

Requires `nativephp/mobile` **^3.2** (for the ephemeral runtime).

Firebase setup
--------------

[](#firebase-setup)

1. Create a Firebase project (free).
2. **iOS:** add an iOS app, download `GoogleService-Info.plist`, place it at `resources/GoogleService-Info.plist` in this plugin. Upload your APNs key under Firebase Console → Cloud Messaging.
3. **Android:** add an Android app, download `google-services.json`, place it at `resources/google-services.json` in this plugin.
4. **Server:** Project Settings → Service Accounts → *Generate new private key*.

```
APS_ENVIRONMENT=production          # 'development' for local device builds
FCM_PROJECT_ID=your-project-id      # server sending
FIREBASE_CREDENTIALS=/abs/path/service-account.json
```

---

Usage (PHP / Livewire) — core's API
-----------------------------------

[](#usage-php--livewire--cores-api)

```
use Native\Mobile\Facades\PushNotifications;
use Native\Mobile\Events\PushNotification\TokenGenerated;

// Enroll (prompts if needed). Token arrives via TokenGenerated.
PushNotifications::enroll();

$status = PushNotifications::checkPermission(); // granted|denied|not_determined|provisional|ephemeral

#[\Native\Mobile\Attributes\OnNative(TokenGenerated::class)]
public function handleToken(string $token)
{
    auth()->user()->update(['push_token' => $token]);
}
```

### Background processing

[](#background-processing)

Send a data message naming any event class. It runs even when the app is backgrounded/killed:

```
// A normal Laravel listener (service provider boot) — runs in the ephemeral runtime.
Event::listen(function (\Lumi\NativePush\Events\PushNotificationReceived $event) {
    // $event->data — persist, queue work, update local SQLite, etc.
});
```

> **Event constructor convention:** the native handler passes the FCM `data` map (minus the `event` key) as a single `array $data` argument. Design your push event classes as `__construct(array $data)` (the bundled `PushNotificationReceived` already does).

Sending from your server (free)
-------------------------------

[](#sending-from-your-server-free)

```
composer require google/auth   # sending machine only
```

```
use Lumi\NativePush\Server\{FcmSender, FcmMessage};

$sender = new FcmSender();

// Tray notification (no PHP on device):
$sender->notify($token, 'Order shipped', 'On its way!', ['url' => '/orders/123']);

// Background event:
$sender->send(
    FcmMessage::make()->to($token)
        ->event(\Lumi\NativePush\Events\PushNotificationReceived::class, ['sync_id' => 42])
);
```

---

License
-------

[](#license)

MIT.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance91

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity39

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.

###  Release Activity

Cadence

Every ~10 days

Total

4

Last Release

34d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e66000dd81684d5864db2c9fbd2a5740ecb90dc172c5b58107c44f916571ac04?d=identicon)[Fatlum](/maintainers/Fatlum)

---

Top Contributors

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

---

Tags

pushnotificationsfirebaseFCMapnsnativephp

### Embed Badge

![Health badge](/badges/fatlum-nativephp-push/health.svg)

```
[![Health](https://phpackages.com/badges/fatlum-nativephp-push/health.svg)](https://phpackages.com/packages/fatlum-nativephp-push)
```

###  Alternatives

[norkunas/onesignal-php-api

OneSignal API for PHP

2431.8M21](/packages/norkunas-onesignal-php-api)[paragraph1/php-fcm

PHP application server for google firebase cloud messaging (FCM)

1991.3M11](/packages/paragraph1-php-fcm)[benwilkins/laravel-fcm-notification

Laravel FCM (Firebase Cloud Messaging) Notification Channel

209975.8k1](/packages/benwilkins-laravel-fcm-notification)[edwinhoksberg/php-fcm

A library for sending Firebase cloud messages and managing user topic subscriptions, device groups and devices.

68371.0k1](/packages/edwinhoksberg-php-fcm)[bentools/webpush-bundle

Send push notifications through Web Push Protocol to your Symfony users.

72301.0k](/packages/bentools-webpush-bundle)[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

37875.0k2](/packages/redjanym-php-firebase-cloud-messaging)

PHPackages © 2026

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