Comments (6)
Here's a suggestion that would allow query functionality to get through that function (it's how I have the code modified in the meantime):
private function _getJsonPath($path)
{
$url = $this->_baseURI;
$path = ltrim($path, '/');
$qaToken = (strpos($path, '?') == FALSE) ? '?' : '&';
$auth = ($this->_token == '') ? '' : $qaToken . 'auth=' . $this->_token;
$incJSON = (strpos($path, '.json') == FALSE) ? '.json' : '';
return $url . $path . $incJSON . $auth;
}
*note, if you use the above, you need to include .json in your original request. e.g. $firebaseLib->get('test.json?orderBy=email'); If you don't include .json, the above will still append .json at the end of that path.
from firebase-php.
I modified the firebaseLib.php file with the following lines to add some query functionality:
...
private $_options;
...
//This functions sets the options and ensures that the data is enclosed in QUOTATIONS
//Just before submitting the data, works really great.
public function setOptions($options = NULL)
{
if($options !== NULL)
{
foreach($options as $f => $v)
{
$new_options[$f] = '"' . $v . '"';
}
} else {
$new_options = $options;
}
$this->_options = $new_options;
}
...
// I modified this function to build the query string just before submitting
// and it converts %22 to QUOTATION marks before returning.
private function _getJsonPath($path)
{
$url = $this->_baseURI;
$path = ltrim($path, '/');
$auth = ($this->_token == '') ? '' : 'auth=' . $this->_token;
if($this->_options != NULL)
{
$data = http_build_query($this->_options);
$auth = "?". str_replace('%22','"',$data) . "&" . $auth;
} else {
$auth = "?" . $auth;
}
$new_url = $url . $path . '.json' . $auth;
return $new_url;
}
from firebase-php.
I'm having the same issue as solyoung. I wanted to use the query options but as you hard code the auth variable as the only query param available you make it impossible to use this without modification. I know it's a very simple wrapper but a more dynamic params approach would be ideal.
from firebase-php.
Thank you for your suggestion, this is a very important feature. I marked it as a todo.
from firebase-php.
I would love to see this feature as well. Then we can use shallow copy and other query options.
'https://samplechat.firebaseio-demo.com/.json?shallow=true'
from firebase-php.
Query parameters are supported in version v2.1.0
https://github.com/ktamas77/firebase-php/releases/tag/v2.1.0
from firebase-php.
Related Issues (20)
- How to set the app or version
- how to set name in push?
- Push Parameters HOT 1
- FirebaseLib HOT 1
- Git push is removing firebase_php folder. HOT 1
- Firestore Usage HOT 1
- Cannot use Database and Auth together HOT 1
- Slow query HOT 8
- firebase connection in php HOT 1
- Firebase created a new authentication HOT 2
- how to authenticate user using email and password
- i got "Permission denied" error
- firebase query "equalTo" doesn't work with "+" symbol HOT 1
- Setting value to 0 (number) is not possible HOT 1
- Credentials provided by firebase HOT 1
- No logging in firebaseLib
- I got 3 arduino devices with same code with same php code using this Lib but in firebase it only update 1 data not simultaneously those 3 devices it requires other device to be turn off so it can be updated HOT 5
- Getting unexpected error code 0/null/100
- Composer with php7.3 first time install issue: HOT 1
- Requirements? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-php.