Support the ongoing development of →
Configuration Laravel
Last updated 1 year ago.

Hello, i am a new dev in Laravel 5

Try it

Config in DB Firebase in panel (Google)

After config your Laravel

Require in composer

composer require kreait/firebase-php ^4.0

enter image description here

Or your add manual in file composer.json

"require": { "kreait/firebase-php": "^4.0" }

create your controller

php artisan make:controller FirebaseController


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Kreait\Firebase;
use Kreait\Firebase\Factory;
use Kreait\Firebase\ServiceAccount;
use Kreait\Firebase\Database;

class FirebaseController extends Controller{

public function index(){

$serviceAccount = ServiceAccount::fromJsonFile(__DIR__.'/Laraveltesting-6aeda3a963f2.json');

$firebase = (new Factory)


$database = $firebase->getDatabase();
$newPost = $database

'title' => 'Post title',
'body' => 'This should probably be longer.'

//$newPost->getKey(); // => -KVr5eu8gcTv7_AHb-3-
//$newPost->getUri(); // =>
//$newPost->getChild('title')->set('Changed post title');
//$newPost->getValue(); // Fetches the data from the realtime database




After set your router


More infos in

Sorry for my bad english.


Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.