2017 © Pedro Peláez
 

yii2-extension yii2-firebase

Yii2 Component to connect to Firebase Database

image

grptx/yii2-firebase

Yii2 Component to connect to Firebase Database

  • Sunday, June 17, 2018
  • by grptx
  • Repository
  • 2 Watchers
  • 5 Stars
  • 1,113 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 6 Versions
  • 20 % Grown

The README.md

yii2-firebase

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

This Yii2 component wraps kreait/firebase-php and allow to easy connect to the Firebase realtime database, (*2)

Installation

Preferred way to install is through Composer:, (*3)

php composer.phar require grptx/yii2-firebase:~0.3.1

Or, you may add, (*4)

"grptx/yii2-firebase": "~0.3.1"

to the require section of your composer.json file and execute php composer.phar update., (*5)

Configuration

...
'components' => [
    'firebase' => [
        'class'=>'grptx\Firebase\Firebase',
        'credential_file'=>'service_account.json', // (see https://firebase.google.com/docs/admin/setup#add_firebase_to_your_app)
        'database_uri'=>'https://my-project.firebaseio.com', // (optional)
    ]
...
]

Optional

to use the autocomplete function of IDE (i.e. Phpstorm) you can optionally replace in the web/index.php the inclusion of Yii.php file and the Application instance:, (*6)

replace:, (*7)

require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
//and 
(new yii\web\Application($config))->run();

with:, (*8)

require (__DIR__.'/../../vendor/grptx/yii2-firebase/src/yii2/Yii.php');
//and
(new \grptx\Firebase\web\Application($config))->run();

now when you need you can use grptx\Firebase\yii2\Yii instead of Yii to use autocomplete of your IDE, (*9)

Usage

Retrive a database ,reference and a value, (*10)

$database = Yii::$app->firebase->getDatabase();
$reference = $database->getReference('path/to/child/location');
$value = $reference->getValue();

or just the reference and a value, (*11)

$reference = Yii::$app->firebase->getReference('path/to/child/location');
$value = $reference->getValue();

for other method see firebase-php.readthedocs.io., (*12)

The Versions

17/06 2018

dev-master

9999999-dev

Yii2 Component to connect to Firebase Database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar grptx

yii2 php7 firebase yii2-components

17/06 2018

v0.4

0.4.0.0

Yii2 Component to connect to Firebase Database

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar grptx

yii2 php7 firebase yii2-components

25/07 2017

v0.3.1

0.3.1.0

Yii2 Component to connect to Firebase Database

  Sources   Download

MIT

The Requires

 

by Avatar grptx

yii2 php7 firebase yii2-components

25/07 2017

v0.3

0.3.0.0

Yii2 Component to connect to Firebase Database

  Sources   Download

MIT

The Requires

 

by Avatar grptx

yii2 php7 firebase yii2-components

21/07 2017

v0.2

0.2.0.0

Yii2 Component to connect to Firebase Database

  Sources   Download

MIT

The Requires

 

by Avatar grptx

yii2 php7 firebase yii2-components

21/07 2017

v0.1

0.1.0.0

  Sources   Download

The Requires

 

by Avatar grptx