partner-it / firebase-rest-php
1.0.5
2016-02-04 07:33 UTC
Requires
- php: >=5.4
- firebase/token-generator: ~3.0
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
This package is not auto-updated.
Last update: 2025-01-04 19:58:45 UTC
README
PHP Wrapper for the Firebase REST API
Installation
Using Composer
$ composer require partner-it/firebase-rest-php
Usage
Create a new client instance:
<?php $fireBaseClient = new FirebaseClient([ 'base_uri' => 'https://xyz.firebaseio.com', ]);
Then either generate a token with your secret key:
<?php $fireBaseClient->generateToken('SecretKey', 'useruid');
or set a token you already have:
<?php $fireBaseClient->setToken('YourToken');
Then use it to make requests:
<?php $response = $fireBaseClient->get('/mypath'); $response = $fireBaseClient->post('/mypath', ['json' => ['key' => 'value']]);
The returned object is a FirebaseResponse
object, to just get the data use
<?php $data = $response->json();
To get the status code
<?php $statusCode = $response->getStatusCode();
You can also grab the underlying response object with
<?php $guzzleResponse = $response->getResponse();