How to get all children in firebase php?

1.9k views Asked by At

What I'm trying to do is to get the all the child or users from firebase. Here is the JSON Data:

    {
      "users":{
             "USER1":{
                      "data1": "123",
                      "data2": "123"
                     },
             "USER2":{
                      "data1" : "456",
                      "data2" : "456"
                     }
              }
    }

Does anyone know how to get the child using firebasephp? I am using https://github.com/ktamas77/firebase-php this firebase php.

1

There are 1 answers

0
Tom Maton On

I'm not a PHP developer so this may not be 100% valid php but looking at the code you would do something possibly like this

$firebase = new Firebase('http://myfirebasename.firebaseio.com', TOKEN);
$users = $firebase->get('/users');

This should return you an array of the data at that endpoint.