You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[config/firebase.php](config/firebase.php) has a new format to support multiple projects
12
+
13
+
### Deprecated
14
+
* Use of `FirebaseAuth`, `FirebaseDatabase`, `FirebaseDynamicLinks`, `FirebaseFirestore`, `FirebaseMessaging`, `FirebaseRemoteConfig` and `FirebaseStorage` facades
Once you have retrieved a component, please refer to the [documentation of the Firebase PHP Admin SDK](https://firebase-php.readthedocs.io)
100
107
for further information on how to use it.
101
108
102
109
**You don't need and should not use the `new Factory()` pattern described in the SDK documentation, this is already
103
110
done for you with the Laravel Service Provider. Use Dependency Injection, the Facades or the `app()` helper instead**
104
111
112
+
### Multiple projects
113
+
114
+
Multiple projects can be configured in [config/firebase.php](config/firebase.php) by adding another section to the projects array.
115
+
116
+
When accessing components, the facade uses the default project. One can also explicitly use a project:
117
+
118
+
```php
119
+
Firebase::auth() // returns an intance of \Kreait\Firebase\Auth with the configuration found for the default project
120
+
// or
121
+
// 'app' is configured as the default project by default, this would be equivalent to Firebase::firestore() when that is the case
122
+
Firebase::project('app')->firestore() // returns an intance of \Kreait\Firebase\Firestore with the configuration found for the 'app' project
123
+
// or
124
+
Firebase::project('secondary-app')->database() // returns an instance of \Kreait\Firebase\Database with the configuration found for the 'secondary-app' project
When upgrading to `laravel-firebase:^3.0` from an earlier version, you have to update your config file.
4
+
5
+
All existing keys need to be wrapped in the projects array and a default project needs to be configured:
6
+
7
+
```php
8
+
[
9
+
'credentials' => [
10
+
'file' => env('FIREBASE_CREDENTIALS'),
11
+
'auto_discovery' => true,
12
+
],
13
+
// ... other keys
14
+
]
15
+
```
16
+
17
+
becomes
18
+
19
+
```php
20
+
[
21
+
'default' => env('FIREBASE_PROJECT', 'app'),
22
+
23
+
'projects' => [
24
+
'app' => [
25
+
'credentials' => [
26
+
'file' => env('FIREBASE_CREDENTIALS'),
27
+
'auto_discovery' => true,
28
+
],
29
+
// ... other keys
30
+
],
31
+
],
32
+
]
33
+
```
34
+
35
+
### Facades
36
+
Existing facades (eg. `Kreait\Firebase\Facades\FirebaseAuth`) are deprecated in favor of the new `Kreait\Firebase\Facades\Firebase` facade in order to support multiple projects. For now, the old facades are included and resolve to the default project for better backward compatibility, but upgrading is advised as they will be removed in the future.
0 commit comments