thanhct/firebase-php

Firebase Admin SDK


README

Interact with Google Firebase from your PHP application.

Current version Supported PHP version Build Status GitHub license Total Downloads Maintainability Test Coverage

Quickstart

Full documentation at firebase-php.readthedocs.io.

composer require thanhct/firebase-php 3.9.4
<?php

require __DIR__.'/vendor/autoload.php';

use Kreait\Firebase\Factory;
use Kreait\Firebase\ServiceAccount;

$serviceAccount = ServiceAccount::fromJsonFile(__DIR__.'/google-service-account.json');

$firebase = (new Factory)
    ->withServiceAccount($serviceAccount)
    ->withDatabaseUri('https://my-project.firebaseio.com')
    ->create();

$database = $firebase->getDatabase();

$newPost = $database
    ->getReference('blog/posts')
    ->push([
        'title' => 'Post title',
        'body' => 'Post body'
    ]);

$newPost->getChild('title')->set('Changed post title');

$newPost->remove();

For errors and missing features, please use the issue tracker.

For general support, join the #php channel at https://firebase.community/.