aliamassi/fcm-notification 问题修复 & 功能扩展

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

邮箱: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
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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