kreait/firebase-bundle
Composer 安装命令:
composer require kreait/firebase-bundle
包简介
Symfony Bundle for the Firebase Admin SDK
README 文档
README
A Symfony Bundle for the Firebase PHP SDK.
Important
Support the project: The Firebase PHP SDK is downloaded 1M+ times monthly and powers thousands of applications. If it saves you or your team time, please consider sponsoring its development.
Note
The project moved from the kreait to the beste GitHub Organization in January 2026.
The namespace remains Kreait\Firebase\Symfony\Bundle and the package name remains kreait/firebase-bundle.
Please update your remote URL if you have forked or cloned the repository.
Overview
Firebase provides the tools and infrastructure you need to develop your app, grow your user base, and earn money. The Firebase Admin PHP SDK enables access to Firebase services from privileged environments (such as servers or cloud) in PHP.
For more information, visit the Firebase Admin PHP SDK documentation.
Installation
Add the bundle using Composer
composer require kreait/firebase-bundle
// Symfony without Flex // in %kernel.root_dir%/AppKernel.php $bundles = array( // ... new Kreait\Firebase\Symfony\Bundle\FirebaseBundle(), ); // Symfony with Flex // in config/bundles.php return [ // ... Kreait\Firebase\Symfony\Bundle\FirebaseBundle::class => ['all' => true], ];
Configuration
Minimal
# app/config/config.yml (Symfony without Flex) # config/packages/firebase.yaml (Symfony with Flex) kreait_firebase: projects: my_project: credentials: '%kernel.project_dir%/config/my_project_credentials.json' other_project: # optional credentials: '%kernel.project_dir%/config/other_project_credentials.json'
The following services will be available for your project:
kreait_firebase.my_project.app_checkkreait_firebase.my_project.authkreait_firebase.my_project.databasekreait_firebase.my_project.firestorekreait_firebase.my_project.messagingkreait_firebase.my_project.remote_configkreait_firebase.my_project.storagekreait_firebase.other_project.*
The following classes will be available for dependency injection if you have configured only one project:
Kreait\Firebase\Contract\AppCheckKreait\Firebase\Contract\AuthKreait\Firebase\Contract\DatabaseKreait\Firebase\Contract\FirestoreKreait\Firebase\Contract\MessagingKreait\Firebase\Contract\RemoteConfigKreait\Firebase\Contract\Storage
To make it easier to use classes via dependency injection in the constructor of a class when multiple projects exist, you can do this in the constructor:
Kreait\Firebase\Contract\AppCheck $myProjectAppCheckKreait\Firebase\Contract\Auth $myProjectAuthKreait\Firebase\Contract\Database $myProjectDatabaseKreait\Firebase\Contract\Firestore $myProjectFirestoreKreait\Firebase\Contract\Messaging $myProjectMessagingKreait\Firebase\Contract\RemoteConfig $myProjectRemoteConfigKreait\Firebase\Contract\Storage $myProjectStorage
Full
# app/config/config.yml (Symfony without Flex) # config/packages/firebase.yaml (Symfony with Flex) kreait_firebase: projects: my_project: # Optional: Path to the project's Service Account credentials file # If omitted, the credentials will be auto-discovered as described # in https://firebase-php.readthedocs.io/en/stable/setup.html credentials: '%kernel.project_dir%/config/my_project_credentials.json' # Optional: Override the project being used # If omitted, the project is automatically derived, e.g. from credentials project_id: 'project-b' # Optional: If set to true, this project will be used when # type hinting the component classes of the Firebase SDK, # e.g. Kreait\Firebase\Auth, Kreait\Firebase\Database, # Kreait\Firebase\Messaging, etc. default: false # Optional: If set to false, the service and its alias can only be # used via dependency injection, and not be retrieved from the # container directly. public: true # Optional: Should only be used if the URL of your Realtime # Database can not be generated with the project id of the # given Service Account database_uri: 'https://my_project.firebaseio.com' # Optional: Make the client tenant aware tenant_id: 'tenant-id' # Optional: Used to cache Google's public keys for ID Token verification. verifier_cache: null # Example: cache.app # Optional: Used to cache the authentication tokens for connecting to the Firebase servers. auth_token_cache: null # Example: cache.app # Optional: Used to cache Google's public keys for AppCheck token verification. key_set_cache: null # Example: cache.app # Optional: Service id of Kreait\Firebase\Http\HttpClientOptions # used to configure the SDK's HTTP client. http_client_options: null # Example: app.firebase.http_client_options
Documentation
For documentation of the underlying SDK, visit the Firebase Admin PHP SDK documentation.
License
This project is licensed under the MIT License.
Your use of Firebase is governed by the Terms of Service for Firebase Services.
kreait/firebase-bundle 适用场景与选型建议
kreait/firebase-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.05M 次下载、GitHub Stars 达 155, 最近一次更新时间为 2015 年 01 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「symfony」 「api」 「bundle」 「google」 「sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kreait/firebase-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kreait/firebase-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kreait/firebase-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
The bundle for easy using json-rpc api on your project
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A PSR-7 compatible library for making CRUD API endpoints
Bundle Symfony DaplosBundle
统计信息
- 总下载量: 5.05M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 155
- 点击次数: 20
- 依赖项目数: 2
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-23