定制 grohiro/laravel-firebase 二次开发

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

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

grohiro/laravel-firebase

Composer 安装命令:

composer require grohiro/laravel-firebase

包简介

Firebase Cloud Message for Laravel

README 文档

README

Firebase Channel plugin for Laravel.

use Illuminate\Notifications\Notification;
use Grohiro\Laravel\FCM\FirebaseChannel;
use paragraph1\phpFCM\Message;
use paragraph1\phpFCM\Recipient\Device;
use paragraph1\phpFCM\Notification;

/**
 * @see https://laravel.com/docs/5.5/notifications#custom-channels
 */
class PushMessage extends Notification
{
  public function via($notifiable)
  {
    return [FirebaseChannel::class];
  }
  
  public function toFcmMessage($user)
  {
    // @see https://github.com/Paragraph1/php-fcm
    $note = new Notification('test title', 'testing body');
    $note->setIcon('notification_icon_resource_name')
        ->setColor('#ffffff')
        ->setBadge(1);
    $message = new Message();
    $message->addRecipient(new Device($user->user_device_token));
    $message->setNotification($note)
            ->setData(array('someId' => 111));
    return $message;
  }
}

Requirements

Usage

1. Install laravel-firebase

$ composer require grohiro/laravel-firebase dev-master

2. Setup Guzzle HTTP client

Add the ServiceProvider to app.php

// config/app.php
'providers' => [
  \Grohiro\Laravel\FCM\ServiceProvider::class,
];

3. Create Laravel Notification class

php artisan make:notification PushNotification

4. Set Firebase API key

// config/app.php
'firebase' => [
  'api_key' => 'your-api-key'
],

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固