定制 aliamassi/fcm-notification 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

aliamassi/fcm-notification

Composer 安装命令:

composer require aliamassi/fcm-notification

包简介

Laravel package to send Firebase Cloud Messaging notifications to Android and iOS.

README 文档

README

Packagist Version License Downloads

Laravel package to send Firebase Cloud Messaging (FCM) notifications to Android and iOS devices.

Requirements

Installation

composer require aliamassi/fcm-notification dev-main

If you want to publish the configuration file, run:

php artisan vendor:publish --provider="AliAmassi\FcmNotification\FirebaseNotificationServiceProvider" --tag="config"

Configuration

Copy your Firebase service account JSON to storage/app/firebase-service-account.json or set the path in your .env:

FIREBASE_CREDENTIALS=/full/path/to/firebase-service-account.json
FIREBASE_PROJECT_ID=your-firebase-project-id

The default config values are defined in config/fcm.php. After publishing, you can find the file at config/fcm.php.

Usage

Use the FirebaseNotification facade or inject AliAmassi\FcmNotification\FirebaseClient.

Sending a Single Notification

use FirebaseNotification;

$response = FirebaseNotification::send(
    'device-token',
    [
      'title' => 'Hello',
      'body' => 'This is a test notification',
    ],
    [
      'foo' => 'bar'
    ]
);

Sending to Multiple Devices

$tokens = ['token1', 'token2', 'token3'];

$response = FirebaseNotification::send(
    $tokens,
    ['title' => 'Batch Title', 'body' => 'Batch Body']
);

The client implementation handles obtaining and caching the access token via OAuth2 using your service account credentials fileciteturn1file5.

Publishing to Packagist

  1. Tag your release:

    git tag v1.0.0
    git push --tags
  2. Submit your repository on Packagist.

Contributing

Contributions are welcome! Please submit issues and pull requests.

License

MIT License. See the LICENSE file.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固