pteal79/native-notification 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pteal79/native-notification

最新稳定版本:1.0.2

Composer 安装命令:

composer require pteal79/native-notification

包简介

A NativePHP plugin for dispatching native notifications via OnNative events

README 文档

README

Dispatches a NativeNotification event through the native layer via a single SendNotification bridge call. The event carries a nullable string payload and can be consumed in PHP with #[OnNative].

Installation

composer require pteal79/native-notification
php artisan vendor:publish --tag=nativephp-plugins-provider
php artisan native:plugin:register pteal79/native-notification
php artisan native:plugin:list

Usage

PHP (Livewire/Blade)

use PTeal79\NativeNotification\Facades\NativeNotification;

NativeNotification::sendNotification('Hello world!');
NativeNotification::sendNotification(null);

Listening for the Event

use Native\Mobile\Attributes\OnNative;
use PTeal79\NativeNotification\Events\MobileEvent;

#[OnNative(MobileEvent::class)]
public function handleNativeNotification(?string $message): void
{
    // $message is the string passed to sendNotification()
}

JavaScript

import { NativeNotification, Events } from '@pteal79/native-notification';
import { on, off } from '@nativephp/native';

await NativeNotification.sendNotification('Hello!');

const handler = (payload) => console.log(payload.message);
on(Events.MobileEvent, handler);
off(Events.MobileEvent, handler);

Events

Event Payload Description
MobileEvent { message: string|null } Dispatched by the native layer when sendNotification is called

License

MIT

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固