/firebase-php5.6

Unofficial Firebase Admin SDK for PHP 5.6

Primary LanguagePHPMIT LicenseMIT

Firebase Admin SDK for PHP 5.6

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.

Thanks for all support of Jérôme Gamez.

Latest Stable Version Total Downloads License Build Status

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.

Documentation

You can find the documentation at https://firebase-php.readthedocs.io/en/2.3.1

    composer require nathanfeitoza/firebase-php5.6

Usage example

$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();