Skip to content

cveldman/laravel-firebase-cloud-messaging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firebase Cloud Messaging

Package to send Firebase Cloud Messaging notification from Laravel.

Trait

You can send messages to a token or a array of tokens, you can also send messages to a topic.

class User extends Authenticatable
{
    use Notifiable;
 
    public function routeNotificationForFirebase(Notification $notification): array|string
    {
        // Return token or topic only
        return $this->firebase_token;
 
        // Return array of tokens or topics
        return $this->notificationTokens->pluck('token');
    }
}
$user->notify(new FirebaseNotification($title, $body));

On-Demand Notifications

Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the Notification facade's route method, you may specify ad-hoc notification routing information before sending the notification:

use Illuminate\Support\Facades\Notification;

Notification::route('firebase', '/topics/news')
            ->notify(new FirebaseMessage('Title', 'Body'));

Progress

  • Event for invalid registration tokens

Google SDK

Cleaning up unused Google services

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages