fatlum/nativephp-push
Composer 安装命令:
composer require 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.
README 文档
README
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
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:
| Layer | Where 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 samePushNotification.*bridge functions — pick one.
What's implemented
- Permission flow + token delivery (
TokenGeneratedfires withtoken+ enrollmentid) - 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:dispatchartisan 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
// 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
- Create a Firebase project (free).
- iOS: add an iOS app, download
GoogleService-Info.plist, place it atresources/GoogleService-Info.plistin this plugin. Upload your APNs key under Firebase Console → Cloud Messaging. - Android: add an Android app, download
google-services.json, place it atresources/google-services.jsonin this plugin. - 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
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
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
datamap (minus theeventkey) as a singlearray $dataargument. Design your push event classes as__construct(array $data)(the bundledPushNotificationReceivedalready does).
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
MIT.
fatlum/nativephp-push 适用场景与选型建议
fatlum/nativephp-push 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「notifications」 「push」 「apns」 「firebase」 「FCM」 「nativephp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fatlum/nativephp-push 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fatlum/nativephp-push 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fatlum/nativephp-push 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova package that adds a notification feed in your Nova app.
PHP framework for easy interaction with Apple's Push Notification Service.
Yii 2 Apns and Gcm together
Apple Push Notification & Feedback Provider
Laravel package to send push notifications to mobile devices (apns, gcm)
Captures outgoing SMS notifications
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-15