PHPackages                             adrorocker/php-firebase - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. adrorocker/php-firebase

ActiveLibrary[API Development](/categories/api)

adrorocker/php-firebase
=======================

A PHP SDK for Google Firebase

v0.3.0(8y ago)5270MITPHPPHP &gt;= 5.6CI failing

Since Oct 28Pushed 5y ago2 watchersCompare

[ Source](https://github.com/adrorocker/php-firebase)[ Packagist](https://packagist.org/packages/adrorocker/php-firebase)[ Docs](https://github.com/adrorocker/php-firebase)[ RSS](/packages/adrorocker-php-firebase/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)DependenciesVersions (6)Used By (0)

[PHP-Firebase](https://github.com/adrorocker/php-firebase)
==========================================================

[](#php-firebase)

A PHP SDK for Firebase REST API.

[![Build status](https://camo.githubusercontent.com/6ec8ff6414f716e448ee54eb26b8533eec11b867cad2033ce5b950552e4dfb74/68747470733a2f2f7472617669732d63692e6f72672f6164726f726f636b65722f7068702d66697265626173652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/adrorocker/php-firebase/)[![Coverage Status](https://camo.githubusercontent.com/84f5ad42d01284aedacc5cfd61930e296d6d43f41fd1507018bd960dd0f7adec/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6164726f726f636b65722f7068702d66697265626173652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/adrorocker/php-firebase)[![Latest Stable Version](https://camo.githubusercontent.com/d4b8d1899692d9badc10f82edcb5f5ae4a5159441e2514076778f36f22f77f93/68747470733a2f2f706f7365722e707567782e6f72672f6164726f726f636b65722f7068702d66697265626173652f762f737461626c65)](https://packagist.org/packages/adrorocker/php-firebase)[![License](https://camo.githubusercontent.com/8ccaefd67ff06278dd7b18e00e60d24fdd2954424128b454ae2bbabaff5cb884/68747470733a2f2f706f7365722e707567782e6f72672f6164726f726f636b65722f7068702d66697265626173652f6c6963656e7365)](https://packagist.org/packages/adrorocker/php-firebase)

---

Installation
------------

[](#installation)

```
composer require adrorocker/php-firebase

```

Usage
-----

[](#usage)

```
require '../vendor/autoload.php';

use PhpFirebase\Firebase;

// Base endpoint
$base = 'https://hey-123.firebaseio.com/somesubendpoint';

// Auth token
$token = 'a1b2c3d4e5f6g7h8i9';

$firebase = new Firebase($base,$token);

// Unique ID
$id = (new \DateTime())->getTimestamp();

// Set the data (body of the request).
$data = ['key' => 'value']; // The data could be even just a string

// Make a PUT request, the response is return
$put = $firebase->put('/logs/'.$id, $data);

// Make a GET request, the response is return,
// you will have all the logs in the $get variable
$get = $firebase->get('/logs');
```

Extras
------

[](#extras)

Now [PHP-Firebase](https://github.com/adrorocker/php-firebase) include a simple way to save and retrieve *Entities* using repositories.

You can use them like this:

- Create an *entity* class

```
// app/Model/User/User.php
