Posts

Showing posts with the label Firebase PHP SDK

Chapter 11 - Update data to Firebase using Laravel PHP

Image
In this chapter, we will learn how to update data to Firebase Cloud Firestore using Laravel PHP package. Consider the list of Student in Firebase Cloud Firestore. We would update these student data for all different type of datatypes of fields. Update normal string field name $student = app('firebase.firestore')->database()->collection('Student')->document(<studentid>); Example $student = app('firebase.firestore')->database()->collection('Student')->document('defT5uT7SDu9K5RFtIdl') ->update([ ['path' => 'name', 'value' => 'John Kone'] ]); After update, firebase will look like this Before updating or even inserting a value for fields like Integer or float, boolean make sure you convert your request params to specific datatype $student = app('...

How to add Laravel package for the Firebase PHP Admin SDK #4

Image
Learn how to add firebase admin sdk to laravel project - php. In this chapter, we will introduce you to SDK built by Kreait ( https://github.com/kreait ). Note this is not official SDK by Firebase. But the most used (1.4M downloads and 1.1K Stars) and maintainable code. Note we are going to use the Laravel - Firebase package built on above it  https://github.com/kreait/laravel-firebase  and Google Firestore PHP SDK   https://github.com/googleapis/google-cloud-php-firestore . So if you want to start building Laravel app, you can jump to related chapter but understanding base code is always necessary. So lets begin. The official document url is https://firebase-php.readthedocs.io/ and github url is  https://github.com/kreait/firebase-php . The minimum requirement of PHP for this package >= 7.0 mbstring, composer and the firebase json credential file explained in before chapters. Installation can be done in your PHP project through composer comp...