This repository is a fork of the original version 2.3.1 so that users of php version 5.6 or lower can work with google firebase.
This SDK makes it easy to interact with Google Firebase applications.
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 https://firebase-php.readthedocs.io/en/2.3.1
composer require nathanfeitoza/firebase-php5.6
$firebase = (new \Firebase\Factory())
->withCredentials(__DIR__.'/path/to/google-service-account.json')
->withDatabaseUri('https://my-project.firebaseio.com')
->create();
$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();