PHP code example of grptx / yii2-firebase

1. Go to this page and download the library: Download grptx/yii2-firebase 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/ */

    

grptx / yii2-firebase example snippets


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

...
'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)
    ]
...
]


//and 
(new yii\web\Application($config))->run();


//and
(new \grptx\Firebase\web\Application($config))->run();


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

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