Skip to main content
Version: 1.x

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

  1. Install this package using composer:

    composer require roddy/firestore-eloquent
  2. Add the following line to the service providers array within your config/app.php file:

    Roddy\FirestoreEloquent\Providers\FModelProvider::class,
  3. Copy and paste this to your .env file and replace path/to/firebase-credentials.json with the path to your credentials JSON file:

    GOOGLE_APPLICATION_CREDENTIALS=path/to/firebase-credentials.json
  4. Copy and paste this to your .env file and replace https://<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
  5. Copy and paste this to your .env file and replace your-project-id with your project ID:

    FIREBASE_PROJECT_ID=your-project-id
  6. 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.