PHP code example of safestudio / firebase-laravel

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

    

safestudio / firebase-laravel example snippets


SafeStudio\Firebase\FirebaseServiceProvider::class,

'Firebase' => SafeStudio\Firebase\Facades\FirebaseFacades::class,

    'firebase' => [
        'database_url' => env('FB_DATABASE', 'https://project-id.firebaseio.com/'),
        'secret' => env('FB_DATABASE_KEY', 'dbsecretkey'),
    ]

$app->register(SafeStudio\Firebase\FirebaseServiceProvider::class);

class_alias(SafeStudio\Firebase\Facades\FirebaseFacades::class, 'Firebase');

$app->withFacades();

$app->configure('services');

    'firebase' => [
        'database_url' => env('FB_DATABASE', 'https://project-id.firebaseio.com/'),
        'secret' => env('FB_DATABASE_KEY', 'dbsecretkey'),
    ]

$data = ['key' => 'data' , 'key1' => 'data1']
Firebase::set('/test/',$data); 

Firebase::get('/test/',['print'=> 'pretty']);

Firebase::push('/test/',$data); 

Firebase::update('/test/',['key1' => 'Updating data by key']); 

Firebase::delete('/test/');