Giter VIP home page Giter VIP logo

firebase-php's Introduction

ktamas77

firebase-php's People

Contributors

brianpilati avatar craigrusso avatar dvidsilva avatar elliotchance avatar ktamas77 avatar llbbl avatar minicodemonkey avatar miyukki avatar saishsali avatar taylornotwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

firebase-php's Issues

_getJsonPath function doesn't allow query strings

The Firebase API offers orderBy and advanced query options. The _getJsonPath function currently appends ".json" to the end of the path without regard to the $path. This should be corrected so that query strings can be passed in the $path.

I may fork and solve, but at least wanted the issue reported in case I don't get back here.

Running too slow

Hello, the script works very slow to 7 seconds to perform each operation, I know that the response of the firebase is fast so I wonder how it does to improve the response speed performance of the script.

Some tips needed on updating foreach loop

Hi there!
Can you suggest me i want to update


$this->firebase = new \Firebase\FirebaseLib($DEFAULT_URL, $DEFAULT_TOKEN);
		$uzrs = json_decode($this->firebase->get('users'));
		foreach($uzrs as $user){
		echo "<pre>";	
			 
			
			foreach($user->chat as $msgs){ 
				if($msgs->type=="image"){
				 // HOW TO UPDATE HEREEEEEEEEEEEEEEEEEE

//HOW TO ADD SOME ADDITIONAL INFO AT CURRENT PATH?
			$this->firebase->push($user->chat,['name'=>'TEST','type'=>'text','message'=>'test test']); /// <!---- THIS NOT WORKING
				}
				
			}


FirebaseLib

With the following code...

<?php
require __DIR__.'/vendor/autoload.php';
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
const DEFAULT_URL = 'https://dbname.firebaseio.com/';
const DEFAULT_TOKEN = '<tokenfromfirebasewebpage>';
const DEFAULT_PATH = '/firebase/example';

$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);

// --- storing an array ---
$test = array(
    "foo" => "bar",
    "i_love" => "lamp",
    "id" => 42
);
$dateTime = new DateTime();
$firebase->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);

// --- storing a string ---
$firebase->set(DEFAULT_PATH . '/name/contact001', "John Doe");

// --- reading the stored string ---
$name = $firebase->get(DEFAULT_PATH . '/name/contact001');

I am getting the following error:
screenshot from 2017-06-08 19-41-55

In the composer.json I have:

"require": {
		"php": ">=5.2.4",
		"kreait/firebase-php": "^3.0"
	}

I am using CodeIgniter 3 but I think that isn't the problem, any idea what it could be?

Cannot use Database and Auth together

I m getting this error:
Fatal error: Cannot use Kreait\Firebase\Http\Auth as Auth because the name is already in use vendor\kreait\firebase-php\src\Firebase\Database.php on line 10

But it doesn't make sense. The conflict comes from the Auth.php because there is already a Class with name Auth but the namespace is different for both, so it should not matter. Right?

Disabling line 10 on Database.php removes the error. Which is am using as a fix.

Get data through php with condition authentication

Hi,
Actually i need to apply rules to my app database. And after applying data display as it is with use of the library. For that I use JWT also to generate custom token and get data with that token also. But not working. JWT I get grom here : https://github.com/luciferous/jwt.
Token generation and signInWithCustomToken process through javascript run successfully. But after that applying same token to get data with php not working. and display:

{error: "Unauthorized request."}

    So let me know where i was wrong.  for the demo purpose I attach code.

send.txt

New firebase authentication

Firebase created a new authentication putting only the secret key returns "Cannot parse token". Now this module only works in public firebase database. Kindly help to resolve this issue.

Install through composer

Hi,

I tried using your library and added it to my zf2 application using composer.
I added this line to my composer.json file

"ktamas77/firebase-php": "dev-master"

The library was successfully added to my zf2 application, but I can't call the Firebase class in the code.
I tried the following
$fb = new Firebase($url, $token);
$fb = new \Firebase($url, $token);

Sorry for the newbie question, but how do I fix this?

Git push is removing firebase_php folder.

I have an application in which I installed this library and it was working fine. But when I push my application using git push firebase_php folder gets changed to something. When I go to my bitbucket dasboard it is showing firebase-php โ†’ fbfeefe [fbfeefe]. I earlier had firebase jwt library so I thought git is getting confused with these two libraries. So I removed firebase jwt library but still it is showing same error.

Too Sloooooow

Hi guys. I tried really everything, but it still slow. I even implemented "use one curl for all quests" but it still slow. I have ten quests and I wait for page 7sec. which is too much. Please help, I need to finish project.

The actual Firebase class seems to be missing?

I'm probably an idiot for asking this, but when running the example I get this:

Fatal error: Class 'Firebase' not found in (.....)/firebase-php/index.php on line 8

The code I'm using is this:

<?php
require 'autoload.php';

const DEFAULT_URL = 'https://xxxx.firebaseio.com';
const DEFAULT_TOKEN = 'yyyy';
const DEFAULT_PATH = '';

$firebase = new Firebase(DEFAULT_URL, DEFAULT_TOKEN);

$test = array(
    "foo" => "bar",
    "i_love" => "lamp",
    "id" => 42
);

$dateTime = new DateTime();

$firebase->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);

?>

try on ubuntu 12.04

is the platform is working on ubuntu 12:04?

because i try using ubuntu server 12.04 its not working, even though i try on my mac is work well

thanks

SET Data fails fot large amount of data in case of single $firebase object

We are testing $firebase->set() for a large amount of data.
The scenario could be replicated in php with this snippet:

$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
foreach($bigamountofdata as $data){
$firebase->set($my_url, $data);
}

When the amount of data is very big and cycle iterate after some seconds the $firebase->set() will fail. It will return a 502 Bad Gateway response in the firt place and then CURL will stop working with this error:
Call to URLFetch failed with application error 1 (URL using bad/illegal format or missing URL) for url MY_URL.

To fix this we edited our code this way:

foreach($bigamountofdata as $data){
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
$firebase->set($my_url, $data);
}

Is this the expected behaviour?

Push Parameters

Please explain the parameters to pass into the push function?
Thanks.

push($path, $data, $options);

Order by

Can we get array using order by?

How to upload image through firebase storage?

Hello, I would like to know if there is a plan to include uploading images through firebase storage, I had to implement the upload in javascript because of the lack of this resource in the lib but I would like to do it via php is it possible?

Firebase->get() with void information

Hi, guys.
I have a dictionary inside the Firebase.
Sometimes I want the information and, it returned a NULL data, even in cases where the information exists in database.
To solve this problem I used an ugly solution: a loop with 3 repetitions searching the information, and a condition when while the variable still empty, then do the loop.

My main question is: there is a better way to do this?
The "$firebase->setTimeOut($seconds);" with the more time will resolve?

taking more response time to connect with firebase

Hi @ktamas77 I am using your Library to get data from firebase using PHP it's good

but here is the problem when I am connected with firebase using library getting 3-4 second document response time in browser network.

Can you please help me to decrease this page response time?

Thanks
-Mitul Bhadeshiya

License

What is the license for firebase-php?

How can i add order by and equalTo

I use firebase-php of ktamas77. I try to get data with orderBy => 'data_id' (child) and equal to 'Test' but it report

"error" : "orderBy must be a valid JSON encoded path"

$test = $initFirebase->get('/notification',array('orderBy' => 'data_id', 'equalTo' => 220));

Is there a way to simulate a transaction?

Hi everyone, I'm searching for a way to simulate a transaction with Rest API. I seen that with this module there's no way to do it. What's the best way to simulate it? Thanks in advance! P.S. I'm sorry for my bad english.

SimpleLogin support(?)

Currently I have implemented your library with user.token, but won't the token expire soon? How can I make sure that I always have a valid token?

Trouble with set and update operations

Hello Katmass77 Team,
I am currently implementing the get,push,update and set operations for my web application, and
encountered the following problems:

  1. With push operation I can successfully push the data to the firebase. But, when pushing the data, rather than having a randomkey generated, is there a way to specify my own(customized) key when performing the push operation?
    The call to the operation from my model layer is:
    $this->firebase->push(FirebasePath::BRANDS.$this->brandId.self::CATEGORIES,$allCategories['value']);

where $allCategories is:
array (
'name' => 'brand_categories',
'value' => 'cid1,cid2'
)

brands push operation

  1. When performing the set and update operations, instead of updating/setting, the operations is deleting the entire tree from categories till its child (see the image below).
    Note: where 81dc9bdb52d04dc20036dbd8313ed055 is the brandId of every brand we have
    brands set

Can you suggest us if we are implementing in a wrong way or is there a problem with the framework.

php not working on remote server

Hi

This might seem a stupid question but I am really stumped.

I have the code on my local server and it works fantastically. The local writes out to firebase, my app picks it up nicely etc. Works as expected.

However, when I upload it to my remote server, which is an exact mirror, it all seems to break. In my error logs it says
PHP Fatal error: Class 'Firebase\FirebaseLib' not found in.....

Is there a way to install this manually, rather than composer? I am very unfamiliar with composer.

Best regards

Check if a token is valid

It would be great if there was a simple way to check if a token is valid for entering data at a specific path. Is there a workaround to achieve this?

Can't use Query string with get method

Hi,
I've used the "get" method to retrieve query data, but it seem didn't work, the error is:
{ "error" : "Constraint index field must be a JSON primitive" }
Pls note that if I put the URL on address bar, I still can get the matched data
https://goldenmuse.firebaseio.com/user.json?orderBy="email"&startAt="[email protected]"&endAt="[email protected]"
Could anyone help me resolve this?
Thanks.

Related issue: #19
Related PR: https://github.com/ktamas77/firebase-php/pull/25/files

How do I know if get () returned any results?

Hello, I am getting an error while scanning the field through the foreach when there is no element of the table I wanted to just display there is no element registered, however I can not check the null test on the return of get someone could help me?

$ListFire = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
$getListFire = $ListFire->get('/users/');
$decodeListFire	= json_decode($getListFire);

if($decodeListFire===null){
// foreach....
}

// Not Work not return true or false in If

Why not take advantage of Keep-Alive?

firebase-php promptly closes the curl handle after each request, making it impossible to take advantage of the underlying protocol's Keep-Alive capability. Since all Firebase API requests use SSL, using Keep-Alive would save a massive amount of time and resources (SSL handshake in addition to TCP handshake) when multiple requests are made in quick succession.

Enabling Keep-Alive with PHP curl is as simple as reusing the same curl handle without closing it.

Firestore Usage

Hi! Is it possible to use this lib with the new firestore db?

"limit" options

limit options in GET-method seem not working. I tried:

$firebase->get('database/posts', ['limit' => 10]);

Everything is not different.

Error in README.md document

I tried to use the library as README.md, PHP can never load class "Firebase".
It turns out that there is no "Firebase" class. I don't know how the other guys could even load it.

This one worked.

$firebase = new \Firebase\FirebaseLib($DEFAULT_URL, $DEFAULT_TOKEN);

This one does not work

$firebase = new Firebase(DEFAULT_URL, DEFAULT_TOKEN);

Cannot filter using equalTo/endAt/startAt with strings

Trying to do $database->ref('some/path')->orderByChild('childname').equalTo('stringvalue')->...

Will throw an error: "Constraint index field must be a JSON primitive".

So it seems strings don't work, but performing the same query in, say, javascript Firebase, is allowed with strings.

Not working on my server

Hey,

When i run the firebaseTest.php on my remote server (Free Web Hosting BIZ.NF) it doesn't work. I debugged the script, and it does stablish a connection with firebase succesfully but the push/read/update methods don't work.

Whilst on my local server, the script works like a charm.

Could it be something wrong with my remote server?

Delete Array of References

(Translated by Google)

I think it would be useful, to be able to establish an Array of references, to the method DELETE, to be able to eliminate many places, with a single call

$info = '/path/to/delete'
$firebase->delete( $info )

or

$info[] = '/path/to/delete/1'
$info[] = '/path/to/delete/2'
$firebase->delete( $info )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.