Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple realtime database support in single project #678

Open
Morfeus73 opened this issue Jan 4, 2022 · 4 comments
Open

Multiple realtime database support in single project #678

Morfeus73 opened this issue Jan 4, 2022 · 4 comments

Comments

@Morfeus73
Copy link

Describe the feature you would like to see

Hi, I have a firebase project that contains multiple realtime databases and I need access to them in Laravel.
I haven't found any information about this.
Thanks in advance.

@jeromegamez
Copy link
Member

At the moment, you can achieve this by using the factory with the same ServiceAccount but multiple calls of the withDatabaseUri() method:

use Kreait\Firebase\Factory;

$factory = (new Factory)->withServiceAccount('/path/to/firebase_credentials.json');

// Other components can be instantiated as usual
$auth = $factory->createAuth();

$db1 = $factory->withDatabaseUri('https://first-db.firebaseio.com')->createDatabase();
$db2 = $factory->withDatabaseUri('https://second-rtdb.firebaseio.com')->createDatabase();

If you're using the kreait/laravel-firebase package, you can achieve the same by configuring multiple projects with the same service account and different URLs (https://github.com/kreait/laravel-firebase/#multiple-projects).

I realize this isn't very intuitive (the component is from a time in which it wasn't yet possible to have multiple real-time databases 😅), so I'll keep this open as a feature request for a later implementation (probably not in the 5.x branch, though) 🤞

@Morfeus73
Copy link
Author

I really thank you so much for such a fast feedback!

@jeromegamez
Copy link
Member

@Morfeus73 Thank you for the one-time donation!

@github-actions
Copy link
Contributor

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let me know if that works for you by leaving a 👍. Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants