2017 © Pedro Peláez
 

library laravel-fcm-notification-channel

Firebase Cloud Messages Notification Driver

image

enniel/laravel-fcm-notification-channel

Firebase Cloud Messages Notification Driver

  • Monday, January 15, 2018
  • by enniel
  • Repository
  • 4 Watchers
  • 15 Stars
  • 7,442 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 13 Forks
  • 6 Open issues
  • 4 Versions
  • 19 % Grown

The README.md

FCM notification channel for Laravel 5.3

This package makes it easy to send notifications using Firebase Cloud Messaging (FCM) with Laravel 5.3. This package is based on brozot/laravel-fcm, so please read that documentation for more information., (*1)

Contents

Installation

You can install this package via composer:, (*2)

``` bash composer require enniel/laravel-fcm-notification-channel:1.*, (*3)

Register the provider directly in your app configuration file `config/app.php`:
``` php
'providers' => [
    // ...

    NotificationChannels\FCM\ServiceProvider::class 
]

Usage

Now you can use the channel in your via() method inside the notification:, (*4)

use NotificationChannels\FCM\FCMMessage;
use Illuminate\Notifications\Notification;

class ExampleNotification extends Notification
{
    public function via($notifiable)
    {
        return ['fcm'];
    }

    public function toFCM($notifiable)
    {
        return (new FCMMessage())
            ->notification([
                'title' => 'Notification title',
                'body' => 'Notification body',
            ]);
    }
}

Available message types:

  • FCMMessage: Send notifications to device(s).
  • FCMMessageTopic: Send notifications to topic(s).
  • FCMMessageGroup: Send notifications to group(s).

In order for your notice to know who to send messages, you must add routeNotificationForFCM method to your notification model., (*5)

Available message methods

  • data(): Notification data. array | LaravelFCM\Message\PayloadData | LaravelFCM\Message\PayloadDataBuilder
  • options(): Notification options. array | LaravelFCM\Message\Options | LaravelFCM\Message\OptionsBuilder
  • notification(): Notification content. array | LaravelFCM\Message\PayloadNotification | LaravelFCM\Message\PayloadNotificationBuilder

Proxy methods. See brozot/laravel-fcm for more information about this methods.

  • setDryRun
  • setPriority
  • setTimeToLive
  • setCollapseKey
  • setDelayWhileIdle
  • setMutableContent
  • setContentAvailable
  • setRestrictedPackageName
  • isDryRun
  • getPriority
  • getTimeToLive
  • getCollapseKey
  • isDelayWhileIdle
  • isMutableContent
  • isContentAvailable
  • getRestrictedPackageName
  • setTag
  • setBody
  • setIcon
  • setTitle
  • setSound
  • setBadge
  • setColor
  • setChannelId
  • setClickAction
  • setBodyLocationKey
  • setBodyLocationArgs
  • setTitleLocationKey
  • setTitleLocationArgs
  • getTag
  • getBody
  • getIcon
  • getTitle
  • getSound
  • getBadge
  • getColor
  • getChannelId
  • getClickAction
  • getBodyLocationKey
  • getBodyLocationArgs
  • getTitleLocationKey
  • getTitleLocationArgs

Testing

bash $ composer test, (*6)

Credits

Support

Having trouble? Open an issue!, (*7)

License

The MIT License (MIT). Please see License File for more information., (*8)

The Versions

20/12 2016

0.0.1

0.0.1.0 https://github.com/enniel/laravel-fcm-notification-channel

Firebase Cloud Messages Notification Driver

  Sources   Download

MIT

The Requires

 

The Development Requires

by Evgeni Razumov

firebase fcm