Releases: kreait/firebase-php
2.1.2
Updated kreait/firebase-tokens to fix #65 (Invalid token when claims are empty).
2.1.1
Updated kreait/firebase-tokens to make sure ID token verifications continue to work.
2.1.0
- Added the means to work with custom tokens and ID tokens by using
kreait/firebase-tokens. See
Authentication: Working with Tokens
for usage instructions. - Replaced the implementation of Database Secret based custom tokens (in the
V2
namespace)
with a solution based onlcobucci/jwt
instead of the
abandoned firebase/token-generator.
These features are also available in a standalone library: kreait/firebase-tokens
2.0.2
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
- 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
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
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()
orlimitToLast()
,
results were lost because Firebase sorts in ascending order and limits the results before
we can process them further.
- Nice in theory, conflicted in practice: when combined with
- Adds a new Method
Reference::getChildKeys()
to retrieve the key names of a reference's children- This is a convenience method around a shallow query, see
shallow queries in the Firebase docs
- This is a convenience method around a shallow query, see
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);
1.2.1
Simplify query construction and ensure that the correct variable types are used (previously, a numeric value would be wrapped into a string)
1.2
Permission errors can now be catched as Kreait\Firebase\Exception\PermissionDeniedException
2.0.0-beta2
Changes to 2.0.0-beta1
It seems more than just possible that the ID of a project given in the Google Service Account JSON file is different to the xxx.firebaseio.com subdomain of a Firebase application. It was already possible to pass the URL of the Realtime Database as a second parameter:
$firebase = Firebase::fromServiceAccount(
__DIR__.'/google-service-account.json',
'https://my-project.firebaseio.com'
);
Now a more visible method is available to do the same:
$firebase = Firebase::fromServiceAccount(__DIR__.'/google-service-account.json')
->withDatabaseUri('https://my-project.firebaseio.com');
Full list of changes: 2.0.0-beta1...2.0.0-beta2
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);