nathanfeitoza/firebase-php5.6

Firebase 管理SDK

1.0.0 2019-09-12 20:05 UTC

This package is auto-updated.

Last update: 2024-09-13 07:02:57 UTC


README

此存储库是原始版本2.3.1的分支,以便PHP版本5.6或更低版本的用户可以使用Google Firebase。

感谢Jérôme Gamez的所有支持。

Latest Stable Version Total Downloads License Build Status

此SDK使得与Google Firebase应用程序交互变得容易。

如有支持需求,请使用问题跟踪器,或加入Firebase社区Slack,网址为https://firebase-community.appspot.com,并加入#php频道。

文档

您可以在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();