Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctf0/laravel-firebase-broadcast-driver
a firebase broadcast driver for laravel
https://github.com/ctf0/laravel-firebase-broadcast-driver
Last synced: 18 days ago
JSON representation
a firebase broadcast driver for laravel
- Host: GitHub
- URL: https://github.com/ctf0/laravel-firebase-broadcast-driver
- Owner: ctf0
- License: mit
- Created: 2019-07-26T06:14:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-22T03:06:40.000Z (about 2 months ago)
- Last Synced: 2024-10-11T12:19:31.512Z (about 1 month ago)
- Language: PHP
- Size: 35.2 KB
- Stars: 7
- Watchers: 1
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
FireBase Broadcast Driver
## Installation
- `composer require ctf0/firebase-broadcast-driver`
- the package internally use [`kreait/firebase-php`](https://firebase-php.readthedocs.io/en/latest/) to send data to firebase.
### Config
```php
// config/broadcastingreturn [
'connections' => [
// ...'firebase' => [
'driver' => 'firebase',
'type' => 'firestore', // database, firestore or messaging
'databaseURL' => env('FB_DB_URL'), // the real time database url
'creds_file' => env('FB_CREDENTIALS_FILE'), // service account json file
'collection_name' => env('FB_COLLECTION_NAME'), // ex.notifications
],
],
];
```### Usage
- add `BROADCAST_DRIVER=firebase` to `.env`
- atm there no support for [laravel-echo](https://laravel.com/docs/5.8/broadcasting#installing-laravel-echo) "any help is appreciated" but no worries, you still get the same payload as other broadcast drivers.
however you can check the [firebase api docs](https://firebase.google.com/docs/database/web/start) or [vuefire](https://github.com/vuejs/vuefire) if you are using `vue`, on how to listen for changes and update your app users accordingly.
#### Notification Data Sample
```json
{
"notifications" : {
"-LkgtAVVw0Ztwyjayd9n" : {
"channel" : "private-App.User.091b0f7e-805b-4aab-8c99-445039157783",
"data" : {
"body" : "some body",
"id" : "d54c44a2-8a42-43a4-bae0-e2b159d1533b",
"title" : "some title",
"type" : "App\\Notifications\\AlertUser"
},
"event" : "Illuminate\\Notifications\\Events\\BroadcastNotificationCreated",
"timestamp": 1564183089538
}
}
}
```
### Security
If you discover any security-related issues, please email [[email protected]](mailto:[email protected]).