diff --git a/src/FirestoreClient.php b/src/FirestoreClient.php index fdc5fc1..b7aa24f 100644 --- a/src/FirestoreClient.php +++ b/src/FirestoreClient.php @@ -176,10 +176,15 @@ public static function getRelativeDatabasePath() return 'projects/' . self::getConfig('projectId') . '/databases/' . self::getConfig('database'); } - public function getApiEndPoint() - { - return $this->apiRoot; - } + public function getApiEndPoint() { + $emulator = getenv('FIRESTORE_EMULATOR_HOST'); + + if ($emulator) { + return $emulator; + } + + return $this->apiRoot; + } /** * @param bool $status