Skip to content

Releases: kreait/firebase-php

2.3.0

06 Apr 09:18
2.3.0
6f48979
Compare
Choose a tag to compare

Allow the usage of a custom token handler when creating a new Firebase instance by adding the factory method withTokenHandler(\Firebase\Auth\Token\Handler $handler).

2.2.0

14 Mar 21:25
2.2.0
f429fdc
Compare
Choose a tag to compare

Introduces Firebase\Factory to create Firebase instances, and deprecate the previous static instantiation methods on the Firebase class.

It is now possible to omit an explicit JSON credentials file,

  • if one of the following environment variables is set with the path to the credentials file:
    • FIREBASE_CREDENTIALS
    • GOOGLE_APPLICATION_CREDENTIALS
  • or if the file is located at
    • ~/.config/gcloud/application_default_credentials.json (Linux, MacOS)
    • $APPDATA/gcloud/application_default_credentials.json (Windows)

The documentation at http://firebase-php.readthedocs.io has been updated

The following methods have been deprecated and will trigger a deprecation warning when used:

  • Firebase::fromServiceAccount()
  • Firebase::fromDatabaseUriAndSecret()

2.1.3

23 Feb 20:34
2.1.3
673290b
Compare
Choose a tag to compare

Ensure that guzzlehttp/psr7 1.4.0 is not used, as it breaks backwards compatibility (see guzzle/psr7#138)

2.1.2

19 Feb 21:18
2.1.2
ab4551a
Compare
Choose a tag to compare

Updated kreait/firebase-tokens to fix #65 (Invalid token when claims are empty).

2.1.1

17 Feb 23:54
2.1.1
54ee087
Compare
Choose a tag to compare

Updated kreait/firebase-tokens to make sure ID token verifications continue to work.

2.1.0

07 Feb 19:27
2.1.0
548ef24
Compare
Choose a tag to compare

These features are also available in a standalone library: kreait/firebase-tokens

2.0.2

26 Dec 21:02
2.0.2
3c3b6a8
Compare
Choose a tag to compare

Added a SERVER_TIMESTAMP constant to the Firebase\Database class to ease the population of fields with Firebase's timestamp server value

use Firebase\Database;

$ref = $db->getReference('my-ref')
          ->set('created_at', Database::SERVER_TIMESTAMP); 

is equivalent to

$ref = $db->getReference('posts/my-post')
          ->set('created_at', ['.sv' => 'timestamp']);

2.0.1

02 Dec 12:48
2.0.1
64b19f2
Compare
Choose a tag to compare
  • Renamed "Firebase SDK" to "Firebase Admin SDK for PHP" to emphasize the similarity to the newly
    introduced official Admin SDKs
    .
  • Added method Reference::getPath() to retrieve the full relative path to a node.
  • Updated docs to make clearer that authenticating with a Database Secret is not recommended since
    the official deprecation by Firebase (see
    the "Database Secrets" section in the "Service Accounts" tab of a project
    )
  • It is now possible to pass a JSON string as the Service Account parameter on Firebase::fromServiceAccount(). Until now, a string would have been treated as the path to a JSON file.

2.0.0

06 Nov 01:15
2.0.0
13aed82
Compare
Choose a tag to compare

Starting with version 2.0, this SDK is PHP7 only! For PHP 5 support, please use Version 1.x.

You can find the documentation at http://firebase-php.readthedocs.io .

2.0.0-beta3

05 Nov 22:01
2.0.0-beta3
ceadc7a
Compare
Choose a tag to compare

Changes to 2.0.0-beta2

  • A PermissionDenied exception is thrown when a request violates the
    Firebase Realtime Database rules
  • An IndexNotDefined exception is thrown when a Query is performed on an unindexed subtree
  • Removes the query option to sort results in descending order.
    • Nice in theory, conflicted in practice: when combined with limitToFirst() or limitToLast(),
      results were lost because Firebase sorts in ascending order and limits the results before
      we can process them further.
  • Adds a new Method Reference::getChildKeys() to retrieve the key names of a reference's children

Full list of changes: 2.0.0-beta2...2.0.0-beta3


Starting with version 2.0, this SDK is PHP7 only! The SDK is considered stable, but will stay in beta until the documentation at http://firebase-php.readthedocs.io has been finished.

Quickstart

Create a service account as described in the Firebase Docs and download the service account JSON file, or retrieve a database secret from your Firebase application's project settings page.

$firebase = Firebase::fromServiceAccount(__DIR__.'/google-service-account.json');
// or
$firebase = Firebase::fromDatabaseUriAndSecret(
    'https://<project>.firebaseio.com',
    '<database secret>'
);

$db = $firebase->getDatabase();

$fullTree = $db
    ->getReference('/')
    ->orderByKey(SORT_DESC)
    ->getValue(); // Shortcut for ->getSnapshot()->getValue()

print_r($fullTree);