在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ktamas77/firebase-php开源软件地址:https://github.com/ktamas77/firebase-php开源编程语言:PHP 100.0%开源软件介绍:Firebase PHP ClientBased on the Firebase REST API. Available on Packagist. Adding Firebase PHP to your project using ComposerFor PHP 7 or latercomposer require ktamas77/firebase-php For PHP 5 use v2.2.4composer 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 upgradeCoding standards check / fixing & tests are integrated with composer. To start, upgrade the required packages: $ composer update Unit TestsAll 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 ValidationThe 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)
|
2022-08-15
2022-08-17
2022-09-23
2023-10-27
2022-08-18
请发表评论