Laravel wrapper of morrislaptop/firestore-php.
Require this package with composer.
composer require mwpeng/firestore-php-laravel
Publish package config file.
php artisan vendor:publish --provider=Mwpeng\FirestorePhpLaravel\ServiceProvider
Config Path to the Firebase JSON key file.
'firebase-credentials' => env('FIREBASE_CREDENTIALS', null),
Check morrislaptop/firestore-php for Methods available.
<?php
use Morrislaptop\Firestore\Firestore;
class ToAccessFirestore {
/**
* @var Firestore
*/
private $firestore;
/**
* @param Firestore $firestore
*
* @return void
*/
public function __construct(Firestore $firestore)
{
$this->firestore = $firestore;
$this->firestore->collection("PathToCollection");
}
}
<?php
use Mwpeng\FirestorePhpLaravel\Facades\Firestore;
Firestore::collection("PathToCollection");