1. Go to this page and download the library: Download tormjens/firestore library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tormjens / firestore example snippets
use TorMorten\Firestore\Firestore;
$firestore = resolve(Firestore::class);
public function __construct(Factory $firestore)
{
$this->firestore = $firestore;
}
$collection = $firestore->collection('users');
$documents = $collection->documents();
$document = $collection->document('1234');
$collection = $firestore->collection('users');
$user = $collection->document('123456');
// Fetches the document from Firebase
$user->fetch();
// Create/update a document
$user->update(['name' => 'tormjens', 'role' => 'developer']);
// Get a document
echo $user->name; // tormjens
// Delete a document
$user->delete();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.