Issam Ressani
Issam Ressani

Reputation: 213

How to use Firebase on Symfony?

I want to use Firebase on my Symfony application, but I don't know which bundle I should use, can you please give me some suggestions?

Thank you in advance.

Upvotes: 4

Views: 14539

Answers (2)

Ravikumar
Ravikumar

Reputation: 149

Download this bundle first: https://github.com/kreait/firebase-bundle

Then in your config file use the below configuration:

 kreait_firebase:
    connections:
      main:
        host: testpro-aee33.firebaseio.com
        secret: Qfqagapp07ZnjFeiZ9GtgsssdF477sdsdL44Ll5g
        references:
          users: users #tablename in the firebase database

Then in your controller,use like below:

$firebase = $this->container->get('kreait_firebase.connection.main');
$users = $this->container->get('kreait_firebase.reference.users');

$users->push([
    'emai' => '[email protected]',
    'id' => '121',
    'name' => 'Dummyname'
]);

$reference = $firebase->getReference('/users');
$userData = $reference->getData();

Upvotes: 5

Saish Sali
Saish Sali

Reputation: 274

You can use firebase PHP client https://github.com/ktamas77/firebase-php. It is based on firebase REST API and allows you to interact with firebase realtime database.

Edit: You can also have a look at: https://github.com/kreait/firebase-php

Upvotes: 9

Related Questions