Skip to content

mwpeng/firestore-php-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

firestore-php-laravel

Laravel wrapper of morrislaptop/firestore-php.

Installation

Require this package with composer.

composer require mwpeng/firestore-php-laravel 

Setup

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),

Usage:

Check morrislaptop/firestore-php for Methods available.

1. Inject firestore to class constructor.

<?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");
    }
    
}

2. Using Firestore Facade.

<?php
use Mwpeng\FirestorePhpLaravel\Facades\Firestore;

Firestore::collection("PathToCollection");

About

Laravel wrapper of morrislaptop/firestore-php

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages