This SDK makes it easy to interact with Google Firebase applications.
Starting with version 2.0, this SDK requires PHP 7 - for PHP 5.5/5.6 support, please use Version 1.x.
For support, please use the issue tracker, or join the Firebase Community Slack at https://firebase-community.appspot.com and join the #php channel.
You can find the documentation at http://firebase-php.readthedocs.io/
$firebase = Firebase::fromServiceAccount(__DIR__.'/google-service-account.json')
$database = $firebase->getDatabase();
$newPost = $database
->getReference('blog/posts')
->push([
'title' => 'Post title',
'body' => 'This should probably be longer.'
]);
$newPost->getKey(); // => -KVr5eu8gcTv7_AHb-3-
$newPost->getUri(); // => https://my-project.firebaseio.com/blog/posts/-KVr5eu8gcTv7_AHb-3-
$newPost->getChild('title')->set('Changed post title');
$newPost->getValue(); // Fetches the data from the realtime database
$newPost->remove();