Skip to content

HamzaAbubakar/codeigniter-firebase-library

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Codeigniter Firebase Library

  1. Install kreait/firebase-php package with Composer.
composer require kreait/firebase-php ^4.18
  1. Edit file application/config/autoload.php replace this following line.
...
$autoload['libraries'] = array('firebase');
...
$autoload['config'] = array('firebase');
...
  1. 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.

  2. 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';
  1. Now. You can use firebase library in the Controller file like this.
$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

About

Firebase library for Codeigniter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%