ktamas77/firebase-php
Composer 安装命令:
composer require ktamas77/firebase-php
包简介
Firebase PHP Client
README 文档
README
Based on the Firebase REST API.
Available on Packagist.
Adding Firebase PHP to your project using Composer
For PHP 7 or later
composer require ktamas77/firebase-php
For PHP 5 use v2.2.4
composer require ktamas77/firebase-php:2.2.4
More info about Composer at getcomposer.org.
Example
// Firebase Token can be found in the Firebase Console: // Settings -> Project Settings -> Service accounts -> Database secrets const URL = 'https://kidsplace.firebaseio.com/'; const TOKEN = 'MqL0c8tKCtheLSYcygYNtGhU8Z2hULOFs9OKPdEp'; const PATH = '/firebase/example'; use Firebase\FirebaseLib; $firebase = new FirebaseLib(URL, TOKEN); // Storing an array $test = [ 'foo' => 'bar', 'i_love' => 'lamp', 'id' => 42 ]; $dateTime = new DateTime(); $firebase->set(PATH . '/' . $dateTime->format('c'), $test); // Storing a string $firebase->set(PATH . '/name/contact001', 'John Doe'); // Reading the stored string $name = $firebase->get(PATH . '/name/contact001');
Supported Commands
// Firebase API commands $firebase->set($path, $value); // stores data in Firebase $value = $firebase->get($path); // reads a value from Firebase $firebase->delete($path); // deletes value from Firebase $firebase->update($path, $data); // updates data in Firebase $firebase->push($path, $data); // push data to Firebase // Query Parameters can be optionally used on all operations, example: $value = $firebase->get($path, ['shallow' => 'true']); // Query Parameter values with quotes example // Documentation: https://firebase.google.com/docs/database/rest/retrieve-data#filtering-by-a-specified-child-key $value = $firebase->get($path, ['orderBy' => '"height"']); // Firebase PHP Library commands $firebase->setToken($token); // set up Firebase token $firebase->setBaseURI($uri); // set up Firebase base URI (root node) $firebase->setTimeOut($seconds); // set up maximum timeout / request
Please refer to the Firebase REST API documentation for further details.
Composer upgrade
Coding standards check / fixing & tests are integrated with composer. To start, upgrade the required packages:
$ composer update
Unit Tests
All the unit tests are found in the "/tests" directory. Due to the usage of an interface, the tests must run in isolation.
The firebaseLib tests have inherent latency due to actual cURL calls to a live firebaseIO account. The firebaseLib tests can be executed by running the following command:
$ composer test
Coding Standards Validation
The codebase is in compliance with PSR-2.
To test coding standards:
$ composer style
To automatically fix standards (whenever it's possible):
$ composer style-fix
The MIT License (MIT)
Copyright (c) 2012-2021 Tamas Kalman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
ktamas77/firebase-php 适用场景与选型建议
ktamas77/firebase-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.92M 次下载、GitHub Stars 达 788, 最近一次更新时间为 2014 年 08 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rest」 「wrapper」 「firebase」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ktamas77/firebase-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ktamas77/firebase-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ktamas77/firebase-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
simple api library.
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
A PSR-7 compatible library for making CRUD API endpoints
Yii2 Extension for sending push notification with both Firebase Cloud Messaging (FCM) HTTP Server Protocols (APIs).
Api bundle
统计信息
- 总下载量: 1.92M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 793
- 点击次数: 10
- 依赖项目数: 14
- 推荐数: 3
其他信息
- 授权协议: MIT
- 更新时间: 2014-08-01