laravel-firebase-sync
laravel-firebase-sync copied to clipboard
Not a real sync yet
If:
- another script or component changes data from firebase
- if data is deleted inside firebase console
- if firebase commands dont get executed
The local db and firebase will be out-of-sync.
For true syncronization there needs to be an additional event handler for firebase events.
As mentioned inthe previous ticket 100% synchronization probably required Firebase to be Master.
Firebase Events will always be called if changes occur.
Until recently, this was not possible. Now that Firebase has implemented Cloud Functions, you could tap into Firebase Realtime Database Triggers and perform logic.
Requirements to get Firebase Syncing back to Laravel
- Setup webhook route in Laravel that listens for Firebase database changes, and updates Eloquent model.
- Add the webhook URL to your Firebase Environment Config
- Deploy a JavaScript Firebase Cloud Function file (to Firebase) that listens for database changes and then broadcasts them to the webhook defined in the environment.
This laravel-firebase-sync
project could also include the JavaScript file for the Firebase Cloud Function. Since there isn't a package.json
file yet, one could be created for the "JavaScript" portion of the package.
Any Ideas if the package will support this ?
+1