Installation
Requirements
Before we start, make sure you have the following installed:
- PHP 8.1 or later
- gRPC extension
- Any requirements found on Cloud Firestore for PHP website
- Laravel 9 or later (Recommended Latest Laravel version)
- Composer
Installation
-
Install this package using composer:
composer require roddy/firestore-eloquent
-
Add the following line to the
service providers
array within yourconfig/app.php
file:Roddy\FirestoreEloquent\Providers\FModelProvider::class,
-
Copy and paste this to your
.env
file and replacepath/to/firebase-credentials.json
with the path to your credentials JSON file:GOOGLE_APPLICATION_CREDENTIALS=path/to/firebase-credentials.json
-
Copy and paste this to your
.env
file and replacehttps://<your-project>.firebaseio.com
with the database URL for your project. You can find the database URL for your project at Firebase Console:FIREBASE_DATABASE_URL=https://<your-project>.firebaseio.com
-
Copy and paste this to your
.env
file and replaceyour-project-id
with your project ID:FIREBASE_PROJECT_ID=your-project-id
-
Publish the package configuration using Artisan:
php artisan vendor:publish --provider="Roddy\FirestoreEloquent\Providers\FModelProvider" --force
You can locate the configuration file in config/firebase.php
.