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 providersarray within yourconfig/app.phpfile:Roddy\FirestoreEloquent\Providers\FModelProvider::class, -
Copy and paste this to your
.envfile and replacepath/to/firebase-credentials.jsonwith the path to your credentials JSON file:GOOGLE_APPLICATION_CREDENTIALS=path/to/firebase-credentials.json -
Copy and paste this to your
.envfile and replacehttps://<your-project>.firebaseio.comwith 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
.envfile and replaceyour-project-idwith 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.