2017 © Pedro Peláez
 

library laravel-firebase

Firebase Cloud Message for Laravel

image

grohiro/laravel-firebase

Firebase Cloud Message for Laravel

  • Wednesday, February 14, 2018
  • by grohiro
  • Repository
  • 1 Watchers
  • 0 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 11 % Grown

The README.md

laravel-firebase

Firebase Channel plugin for Laravel., (*1)

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, (*2)

// 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'
],

The Versions

14/02 2018

dev-master

9999999-dev

Firebase Cloud Message for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar grohiro

14/02 2018

1.0.1

1.0.1.0

Firebase Cloud Message for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar grohiro

18/12 2017

1.0

1.0.0.0

Firebase Cloud Message for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar grohiro