kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
992 stars 163 forks source link

[Auth] Unresolvable dependency #130

Closed azzazkhan closed 2 years ago

azzazkhan commented 2 years ago

Error

Unresolvable dependency resolving [Parameter #0 [ <required> string $projectId ]] in class Kreait\Firebase\Auth\ApiClient

How to reproduce

Code snippet from web.php file.

use Illuminate\Support\Facades\Route;
use Kreait\Firebase\Auth as FirebaseAuth;

Route::get('/', function (FirebaseAuth $auth) { // Binding resolution error
    // return view('welcome');
});

Expected behavior

Should resolve dependency without throwing any errors

Environment

OS: Ubuntu 20.04 PHP: 8.1.4 Composer: 2.3.3 laravel/framework: ^9.2 kreait/laravel-firebase: ^4.1

jeromegamez commented 2 years ago

Please see this issue that describes the same problem

https://github.com/kreait/firebase-php/issues/696#issuecomment-1086661275

Alternatively, have a look at the readme of the package, you'll find the correct usage there. (You need to reference the interface, not the implementation)

(Please excuse the short answer without more links, I'm currently on vacation and have only my phone with me)