Firebase in PHP Part-2: How to install firebase php & connect database connection in Firebase PHP

Here, we are learning about firebase with php, where we will install firebase or download the firebase package and work on CRUD application in php. so, Firebase in PHP.

Link to download GitHub : .

Or else: use composer to install : composer require kreait/firebase-php ^5.0

Now to connect your database and understand how its working you have to watch above video and paste the below code:

Step 1: as we are continueing with the above video, so lets create folder includes and inside that dbcon.php and paste the below:

   require __DIR__.'/vendor/autoload.php';

   use Kreait\Firebase\Factory;
   use Kreait\Firebase\ServiceAccount;

   // This assumes that you have placed the Firebase credentials in the same directory
   // as this PHP file.
   $serviceAccount = ServiceAccount::fromJsonFile(__DIR__ . '/yourjsonfile.json');
   $firebase = (new Factory)
   $database = $firebase->getDatabase();

© Copyright - 2018 - 2021 | All rights reserved at Funda of Web IT