Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nazreen-cod's avatar

How to make a connection laravel with a firebase

I'm trying to connect a Laravel web application to Firebase, but I've run into difficulties. Specifically, I followed a tutorial and installed the necessary package (kreait/laravel-firebase), but I’m unable to establish a connection.

1 like
8 replies
nazreen-cod's avatar

@vincent15000

@php artisan package:discover --ansi <php

return [ 'credentials' => [ 'path' => 'my-firebase-app\firebase-credentials.json', 'credentials' => [ 'path' => 'my-firebase-app\firebase-credentials.json', 'path' => 'my-firebase-app\firebase-credentials.json', ], ], ]; ]; Illuminate\Contracts\Container\BindingResolutionException Illuminate\Contracts\Container\BindingResolutionException

Target class [files] does not exist. Target class [files] does not exist.

at vendor\laravel\framework\src\Illuminate\Container\Container.php:946 at vendor\laravel\framework\src\Illuminate\Container\Container.php:946 942▕ 943▕ try { 942▕ 943▕ try { 944▕ $reflector = new ReflectionClass($concrete); 945▕ } catch (ReflectionException $e) { 943▕ try { 944▕ $reflector = new ReflectionClass($concrete); 945▕ } catch (ReflectionException $e) { ➜ 946▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); 947▕ } 944▕ $reflector = new ReflectionClass($concrete); 945▕ } catch (ReflectionException $e) { ➜ 946▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); 947▕ } 948▕ ➜ 946▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); 947▕ } 948▕ 949▕ // If the type is not instantiable, the developer is attempting to resolve 947▕ } 948▕ 949▕ // If the type is not instantiable, the developer is attempting to resolve 950▕ // an abstract type such as an Interface or Abstract Class and there is

949▕         // If the type is not instantiable, the developer is attempting to resolve
950▕         // an abstract type such as an Interface or Abstract Class and there is

1 [internal]:0 950▕ // an abstract type such as an Interface or Abstract Class and there is

1 [internal]:0 Illuminate\Foundation\Application::Illuminate\Foundation{closure}(Object(Illuminate\Foundation\Support\Providers\EventServiceProvider), "Illuminate\Foundation\Support\Providers\EventServiceProvider") 1 [internal]:0 Illuminate\Foundation\Application::Illuminate\Foundation{closure}(Object(Illuminate\Foundation\Support\Providers\EventServiceProvider), "Illuminate\Foundation\Support\Providers\EventServiceProvider") Illuminate\Foundation\Application::Illuminate\Foundation{closure}(Object(Illuminate\Foundation\Support\Providers\EventServiceProvider), "Illuminate\Foundation\Support\Providers\EventServiceProvider")

2 vendor\laravel\framework\src\Illuminate\Container\Container.php:944

2 vendor\laravel\framework\src\Illuminate\Container\Container.php:944 ReflectionException::("Class "files" does not exist") ReflectionException::("Class "files" does not exist")

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

how do i solve this error

1 like
nazreen-cod's avatar

@vincent15000 because by following the website that you gave me. the second step for Integrating Firebase into Laravel i need to open app.php in config folder and add the service provider to the providers array:
'providers' => [ // ... App\Providers\FirebaseServiceProvider::class, ],

1 like

Please or to participate in this conversation.