plokko/firebase-php
Composer 安装命令:
composer require plokko/firebase-php
包简介
Firebase API php implementation
README 文档
README
Php implementation of Firebase API.
Why
This package is built to be simple, scalable and configurable to allow easy integration in other packages or frameworks (ex: laravel-firebase ).
This package uses google/auth to generate OAuth2.0 tokens from the service account and guzzlehttp/guzzle as http library.
Install
Install it with composer via
composer require plokko/firebase-php
Usage
All the calls on the API are made using a Firebase OAuth2.0 token, this token is generated using your ServiceAccount informations.
Service Account
To use the API you need to authenticate the requests with your service account:
this is done by the ServiceAccount class that uses your Firebase ServiceAccount json credential file.
You can download your service account json file from the Firebase console in settings > service accounts, keep in mind to store this file in a secure non-public location.
use Plokko\Firebase\ServiceAccount; //Use one of those methods: $sa = new ServiceAccount('/path/to/your/serviceaccount/file.json'); $sa = new ServiceAccount('{"type":"service_account",..............}'); $sa = new ServiceAccount(['type'=>'service_account',/*...*/]);
Accepted methods for the constructor are:
- string: ServiceAccount file content (json string)
- string: path to the serviceAccount json file
- array: php-translated array of the service account content
You can also add a token cache handler via the setCacheHandler method that accepts an implementation of CacheItemPoolInterface to allow custom cache integrations.
see google/auth MemoryCacheItemPool for an example implementation:
$handler = new Google\Auth\Cache\MemoryCacheItemPool\MemoryCacheItemPool(); $sa->setCacheHandler($handler);
FCM
This package implements FCM Http v1 Api
Real time database
This package includes the Firebase Real time database API integration
plokko/firebase-php 适用场景与选型建议
plokko/firebase-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 112.07k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2018 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 plokko/firebase-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 plokko/firebase-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 112.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 12
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-21