ahsankhatri / firestore-php Goto Github PK
View Code? Open in Web Editor NEWFirestore PHP Client (without gRPC extension)
License: MIT License
Firestore PHP Client (without gRPC extension)
License: MIT License
Hi! i'm trying to update the document using $firestoreClient->setDocument()
. But it's giving me an error "The path you have defined is invalid. Path: categories". Please help me what i'm missing. Thank you
Here is my code
$collection = "categories"; $documentId = $id; $firestoreClient->setDocument($collection, $documentId, [ 'name' => $request->name, 'description' => $request->description, 'picture' => $filename, ], [ 'exists' => true, // Indicate document must exist ] );
Is it me or are API keys no longer available for the firestore API. ?
I cannot seem to find them here : API sdk
Is there an option to query a document by attribute / value binding ?
EX $firestoreClient->getDocument('companies/name/CompanyName')
?
Custom filter.
Does it accept any other search attribute than collection id ?
Ex name, date or any other key / value combination.
Hi,
We want to add or update multiple documents, Is any functions included for that. Thanks in advance.
$collections = $firestoreClient->listDocuments('users', [
'pageSize' => 1,
'pageToken' => 'nextpagetoken'
]);
in this if i try to set pageSize as 2 then i am not getting any response.
I've been looking at the docs and the code but I can't find a way to get the id of a new document. Is it possible?
Here's an example:
$firestoreClient = new FirestoreClient('xxx', 'yyyyyyyyyyyyyyyyyyyyyyy', [
'database' => '(default)',
]);
$document = new FirestoreDocument;
$document->fillValues($data);
$firestoreClient->addDocument('my-collection', $document);
$newdocid = ??????
I got the following error:
Problem 1
- morrislaptop/firestore-php[v2.2.0, ..., v2.2.2] require kreait/firebase-php ^4.15 -> found kreait/firebase-php[4.15.0, ..., 4.x-dev] but it conflicts with your root composer.json require (^5.17).
- Root composer.json requires morrislaptop/firestore-php ^2.2 -> satisfiable by morrislaptop/firestore-php[v2.2.0, v2.2.1, v2.2.2].
Hi,
When I am trying to auth:
$firestoreClient
->authenticator()
->signInAnonymously();
I am getting
Call to undefined method MrShan0\PHPFirestore\Authentication\FirestoreAuthentication::setLastResponse() at ahsankhatri\\firestore-php\\src\\Authentication\\FirestoreAuthentication.php:155
Any ideas?
Thanks
In my project I have already guzzlehttp/guzzle ~7.x installed which I don't want to downgrade. Composer dependencies here says guzzlehttp/guzzle ~6.0|~5.0|~4.0 which do not satisfy my needs.
Is there an dependency upgrade planned for this?
Thanks for short info - appreciate your work!!
i am using your this code i am getting an error
error: Class 'App\Http\Controllers\FirestoreClient' not found
and when i sue this:
use Ahsankhatri\Firestore\FirestoreClient;
then again i got an error
error: Class 'Ahsankhatri\Firestore\FirestoreClient' not found
please help me how fix it please help me please
i am new actually so that's why m not able to understand that how to solve it
Please provide version that support guzzle version 6 and up
How can i add a collection?
Tnks
$val = [
'timestamp' => new FirestoreTimestamp,
'a' => ['b'=>['c'=>'test']],
];
$ret = $firestoreClient->updateDocument($path, $val);
Unable to handle nested native arrays.
This code will fail, and add no fields to the document, if the given fields are present they will be deleted, there is no exception raised, payload will just be empty.
how to get doucment id after listDocuments?
Hello sir,
I am working on firestore with laravel api using this package composer require ahsankhatri/firestore-php
but i want collection=>document=>collection=>document=>collection=>document
Hi, I'm adding the auth property in the FirestoreClient constructor function to fulfill a security rule in my Firestore project in this way,
$this->firestoreClient = new FirestoreClient('my_project_id', 'my_api_key', [
'database' => '(default)',
'auth' => '{ uid: "some_number" }'
]);
but I always get 'PERMISSION DENIED' 'Missing or insufficient permissions'.
What is the proper way to add this to the initial config object?
Is there a way to write a batch insert?
Hello --
What am I missing here:
$firestoreClient = new FirestoreClient('test-project-123', 'AIzXXXXX', [
'database' => '(default)',
]);
$collections = $firestoreClient->listDocuments('test', [
'pageSize' => 1,
'pageToken' => 'nextpagetoken'
]);
MrShan0\PHPFirestore\Exceptions\Client\Forbidden
You do not have permission to access the requested resource. Response: {
"error": {
"code": 403,
"message": "Missing or insufficient permissions.",
"status": "PERMISSION_DENIED"
}
}
I checked my API keys, everything looks good.
$companies $this->firestoreClient->listDocuments('companies');
So far this is im stuck with, but i dont want to select all the documents under companies
collection, and i dont see any way in the documentation to only select specific documents from a collection of documents.
I tried to write to FireStore but the server responded 403 PERMISSION_DENIED: Missing or insufficient permissions.
The database rule is:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth.uid != null;
}
}
}
If I change rule to allow read, write: if true;
(turn off database security), it's OK.
According to official Google library its the best way how to work with resources (at least for beginners). I can try write PR, but please tell me your opinion for this. Thanks.
Do not use API keys for local or production applications. For almost all cases, you should use service accounts. (Authentication DOC)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.