将Firebase与php Codeigniter 3连接的任何解决方案或方法?

时间:2019-04-05 12:11:50

标签: php firebase firebase-realtime-database firebase-authentication codeigniter-3

任何将Firebase与php Codeigniter-3连接的方法或解决方案?或可以互相连接吗?

1 个答案:

答案 0 :(得分:1)

  

您可以通过以下方式在项目中使用FireBase:   https://github.com/eelkevdbos/firebase-php

     

使用Firebase \ Firebase;

$fb = Firebase::initialize(YOUR_FIREBASE_URL, YOUR_FIREBASE_SECRET);

//or set your own implementation of the ClientInterface as second parameter of the regular constructor
$fb = new Firebase([ 'base_url' => YOUR_FIREBASE_BASE_URL, 'token' => YOUR_FIREBASE_SECRET ], new GuzzleHttp\Client());

//retrieve a node
$nodeGetContent = $fb->get('/node/path');

//set the content of a node
$nodeSetContent = $fb->set('/node/path', array('data' => 'toset'));

//update the content of a node
$nodeUpdateContent = $fb->update('/node/path', array('data' => 'toupdate'));

//delete a node
$nodeDeleteContent = $fb->delete('/node/path');

//push a new item to a node
$nodePushContent = $fb->push('/node/path', array('name' => 'item on list'));

Firebase connection with codeigniter in php