Bridge between a Laravel application and a webup/push instance
webup/laravel-push is a Laravel package for bridge between a laravel application and a webup/push instance.
It currently has 0 GitHub stars and 367 downloads on Packagist (latest version v1.1.0).
Install it with composer require webup/laravel-push.
Discover more Laravel packages by webup
or browse all Laravel packages to compare alternatives.
Last updated
This package serves as a bridge between a Laravel application and a webup/push instance.
$ composer require webup/laravel-push
Set the PUSH_API_BASE_URI environment variable to the URI for webup/push.
Please note webup/push listens on port 3000 by default.
'push_api' => [
'base_uri' => env('PUSH_API_BASE_URI'),
'app_name' => env('PUSH_API_APP_NAME')
]
Webup\LaravelPush\Jobs\Token\AssignToken can be called directly from a controller or pretty much any class you need it in.
To do so you must import the job in your class with the following use statement:
use Webup\LaravelPush\Jobs\Token\AssignToken;
You can then perform a dispatch_now(), while specifying an id, which is meant to identify which user/device/whatever the Token is linked to, as well as an array containing:
token (the device's FCM push token)platform (iOS or Android, respectively 1 and 2)language code.For example:
dispatch_now(new AssignToken(
auth()->user()->id, // In this case, user to whom the token is assigned
[
'token' => $push_token, // The device's FCM push token
'platform' => $device_type, // iOS (1) or Android (2)
'language' => 'fr', // The device's language code
]
));
Webup\LaravelPush\Jobs\Token\RemoveToken works exactly the same as AssignToken, but serves the purpose of removing the token from your database.