I want to connect firebase database with my codeigniter project in php.
I not able to find the exact solution and library..
Please recommend the correct library with correct steps that I should follow to connect.
Thanks in advance.
You can use this library https://github.com/eelkevdbos/firebase-php
composer require kreait/firebase-php ^4.18
application/config/autoload.php
replace this following line....
$autoload['libraries'] = array('firebase');
...
$autoload['config'] = array('firebase');
...
Goto Firebase Console navigate to Project settings -> Service accounts in the Firebase Admin SDK tab, click to the "Generate new private key" button then click "Generate key" to download .json file and save as to application/config
folder in the project.
Copy your .json file name from step 3. replace it to application/config/firebase.php
file in the $config['filebase_app_key]
array like this.
$config['firebase_app_key'] = __DIR__ . '/../config/your-app-firebase-adminsdk-xxxxx-xxxxxxxxxx.json';
$this->load->library('firebase');
$firebase = $this->firebase->init();
$db = $firebase->getDatabase();
You can find more usage examples at https://firebase-php.readthedocs.io/en/stable/overview.html#usage-example. and https://www.cloudways.com/blog/php-firebase-integration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With