PHP code example of partner-it / firebase-rest-php

1. Go to this page and download the library: Download partner-it/firebase-rest-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

partner-it / firebase-rest-php example snippets




$fireBaseClient = new FirebaseClient([
	'base_uri' => 'https://xyz.firebaseio.com',
]);



$fireBaseClient->generateToken('SecretKey', 'useruid');



$fireBaseClient->setToken('YourToken');



$response = $fireBaseClient->get('/mypath');

$response = $fireBaseClient->post('/mypath', ['json' => ['key' => 'value']]);



$data = $response->json();



$statusCode = $response->getStatusCode();



$guzzleResponse = $response->getResponse();