[英]How to make my database connection as firebase in laravel?
I am using laravel framework along with firebase database , i am struggling to make default database as a firebase in Databse.php file for that i could not able to figure out port-number,host socket etc..,can you please explain me how to setup as a default connection in laravel ..?我正在使用 laravel 框架和 firebase 数据库,我正在努力将默认数据库作为Databse.php文件中的 firebase,因为我无法弄清楚端口号、主机套接字等...,请你解释一下如何在 laravel 中设置为默认连接..?
DB_CONNECTION=firebase //i want to make firebase
DB_HOST=
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
This will not work out alike that, because Firebase doesn't support SQL - but you can add the firebase-php
library as a composer dependency and then create a Controller
- or even a Provider
;这不会像那样工作,因为 Firebase 不支持 SQL - 但您可以将firebase-php
库添加为 composer 依赖项,然后创建一个Controller
- 甚至是一个Provider
; you'd have to connect with a service account credentials JSON.您必须使用服务帐户凭据 JSON 连接。
This package requires Laravel 8.x and higher or Lumen 8.x and higher.该软件包需要 Laravel 8.x 及更高版本或 Lumen 8.x 及更高版本。
composer require kreait/laravel-firebase
https://github.com/kreait/laravel-firebase https://github.com/kreait/laravel-firebase
Once you have downloaded the Service Account JSON file, you can configure the package by specifying environment variables starting with FIREBASE_ in your .env file.下载服务帐户 JSON 文件后,您可以通过在 .env 文件中指定以 FIREBASE_ 开头的环境变量来配置包。 Usually, the following are required for the package to work:通常,要使包正常工作,需要以下条件:
https://firebase-php.readthedocs.io/en/stable/index.html https://firebase-php.readthedocs.io/en/stable/index.html
relative or full path to the Service Account JSON file
FIREBASE_CREDENTIALS=
# You can find the database URL for your project at
FIREBASE_DATABASE_URL=https://.firebaseio.com FIREBASE_DATABASE_URL=https://.firebaseio.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.