2017 © Pedro Peláez
 

library firebase-php

Firebase API php implementation

image

plokko/firebase-php

Firebase API php implementation

  • Wednesday, July 25, 2018
  • by plokko
  • Repository
  • 2 Watchers
  • 7 Stars
  • 256 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 412 % Grown

The README.md

Firebase php

Php implementation of Firebase API., (*1)

Why

This package is built to be simple, scalable and configurable to allow easy integration in other packages or frameworks (ex: laravel-firebase )., (*2)

This package uses google/auth to generate OAuth2.0 tokens from the service account and guzzlehttp/guzzle as http library., (*3)

Install

Install it with composer via, (*4)

composer require plokko/firebase-php, (*5)

Usage

All the calls on the API are made using a Firebase OAuth2.0 token, this token is generated using your ServiceAccount informations., (*6)

Service Account

To use the API you need to authenticate the requests with your service account: this is done by the ServiceAccount class that uses your Firebase ServiceAccount json credential file. You can download your service account json file from the Firebase console in settings > service accounts, keep in mind to store this file in a secure non-public location., (*7)

use Plokko\Firebase\ServiceAccount;

//Use one of those methods:
$sa = new ServiceAccount('/path/to/your/serviceaccount/file.json');
$sa = new ServiceAccount('{"type":"service_account",..............}');
$sa = new ServiceAccount(['type'=>'service_account',/*...*/]);

Accepted methods for the constructor are: - string: ServiceAccount file content (json string) - string: path to the serviceAccount json file - array: php-translated array of the service account content, (*8)

You can also add a token cache handler via the setCacheHandler method that accepts an implementation of CacheItemPoolInterface to allow custom cache integrations., (*9)

see google/auth MemoryCacheItemPool for an example implementation:, (*10)

$handler = new Google\Auth\Cache\MemoryCacheItemPool\MemoryCacheItemPool();
$sa->setCacheHandler($handler);

FCM

This package implements FCM Http v1 Api, (*11)

see FCM docs, (*12)

Real time database

This package includes the Firebase Real time database API integration, (*13)

see Real time database docs, (*14)

The Versions

25/07 2018

dev-master

9999999-dev

Firebase API php implementation

  Sources   Download

MIT

The Requires

 

10/07 2018

0.1.2

0.1.2.0

Firebase API php implementation

  Sources   Download

MIT

The Requires

 

23/02 2018

0.1.1

0.1.1.0

Firebase API php implementation

  Sources   Download

MIT

The Requires

 

22/02 2018

0.1.0

0.1.0.0

Firebase API php implementation

  Sources   Download

MIT

The Requires