GithubHelp home page GithubHelp logo

spgwebdev / laravel-fcm-notification-channel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from enniel/laravel-fcm-notification-channel

1.0 1.0 0.0 32 KB

License: MIT License

PHP 93.61% Roff 6.39%

laravel-fcm-notification-channel's Introduction

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.

Contents

Installation

You can install this package via composer:

composer require enniel/laravel-fcm-notification-channel:1.*

Register the provider directly in your app configuration file config/app.php:

'providers' => [
    // ...

    NotificationChannels\FCM\ServiceProvider::class 
]

Usage

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

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.

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

$ composer test

Credits

Support

Having trouble? Open an issue!

License

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

laravel-fcm-notification-channel's People

Contributors

enniel avatar spgwebdev avatar tssujt avatar yuesh avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.