Posts

Showing posts with the label Firebase PHP SDK

How to make Firebase query search not case sensitive #18

Image
How to make Firebase query search not case sensitive because you know Firebase provide exact match "==" with case sensitive. So we will solve this issue in the chapter in detail. We will use the Laravel PHP SDK for the firebase for all the queries stuff. Also we will see case insensitive sorting with Firebase orderBy using Firebase search ignoring case. Now lets consider a simple example, you have 'Student' list and you want to search by name. So the main use of any search is that, you insert one or two characters and the system should search the most matching one, but that not the case in Firebase. Firebase is a case sensitive. Means string "Name" and "name" are two different values for Firebase. All Firebase developers are facing this issue, which is most basic necessity. So lets first understand, currently what is provided by Firebase. See the below example of Student List. Now here you see, we have a Student ...

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...