ahsankhatri / firestore-php

Firestore PHP Client (without gRPC extension)
MIT License
62 stars 57 forks source link

How to use or get FirestoreClient Library before Initialization FirestoreClient #5

Closed manikamg closed 5 years ago

manikamg commented 5 years ago

i am using your this code i am getting an error error: Class 'App\Http\Controllers\FirestoreClient' not found

and when i sue this: use Ahsankhatri\Firestore\FirestoreClient;

then again i got an error error: Class 'Ahsankhatri\Firestore\FirestoreClient' not found

please help me how fix it please help me please

i am new actually so that's why m not able to understand that how to solve it

ahsankhatri commented 5 years ago

You need to read documentation on github.

On Sat, 20 Apr 2019 at 2:20 PM, manikamg notifications@github.com wrote:

i am using your this code i am getting an error error: Class 'App\Http\Controllers\FirestoreClient' not found

and when i sue this: use Ahsankhatri\Firestore\FirestoreClient;

then again i got an error error: Class 'Ahsankhatri\Firestore\FirestoreClient' not found

please help me how fix it please help me please

i am new actually so that's why m not able to understand that how to solve it

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahsankhatri/firestore-php/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXTKNFP37G6AMW4KE5KRILPRLN4BANCNFSM4HHJJZCA .

manikamg commented 5 years ago

This is my code below, wher i am doing wrong:

<?php

namespace App\Http\Controllers;

// require 'vendor/autoload.php'; use Ahsankhatri\Firestore\FirestoreClient; use Illuminate\Http\Request;

class FirestoreController extends Controller { public function index(){ $firestoreClient = new FirestoreClient('project-id', 'djhjdhjhdjdhfjdsjfjjfdjsfdj', [ 'database' => '(default)', ]);

    $collections = $firestoreClient->listDocuments('pohjjuusts', [
        'pageSize' => 1,
        'pageToken' => 'nextpagetoken'
    ]);

    print_r($collections);
}

}

ahsankhatri commented 5 years ago

You’re resolving via wrong namespaces. Replace your $firestoreClient with following:

$firestoreClient = new \MrShan0\PHPFirestore\FirestoreClient('project-id', 'AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', [
    'database' => '(default)',
]);
manikamg commented 5 years ago

I have evrythin n providing it as you said but it gives an error again

The project project-id does not exist or it does not contain an active Cloud Datastore or Cloud Firestore database

On Sat, Apr 20, 2019 at 3:08 PM Ahsan Muhammad Yousuf < notifications@github.com> wrote:

You’re resolving via wrong namespaces. Replace your $firestoreClient with following:

$firestoreClient = new \MrShan0\PHPFirestore\FirestoreClient('project-id', 'AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', [ 'database' => '(default)', ]);

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahsankhatri/firestore-php/issues/5#issuecomment-485079539, or mute the thread https://github.com/notifications/unsubscribe-auth/AIS5L4PNYV2DBUWJ2FURLU3PRLQBVANCNFSM4HHJJZCA .

manikamg commented 5 years ago

please brother help me really its very important for me. its do or die

On Sat, Apr 20, 2019 at 3:33 PM G. Manikam naidu gmanikam1989@gmail.com wrote:

I have evrythin n providing it as you said but it gives an error again

The project project-id does not exist or it does not contain an active Cloud Datastore or Cloud Firestore database

On Sat, Apr 20, 2019 at 3:08 PM Ahsan Muhammad Yousuf < notifications@github.com> wrote:

You’re resolving via wrong namespaces. Replace your $firestoreClient with following:

$firestoreClient = new \MrShan0\PHPFirestore\FirestoreClient('project-id', 'AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', [ 'database' => '(default)', ]);

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahsankhatri/firestore-php/issues/5#issuecomment-485079539, or mute the thread https://github.com/notifications/unsubscribe-auth/AIS5L4PNYV2DBUWJ2FURLU3PRLQBVANCNFSM4HHJJZCA .

manikamg commented 5 years ago

i have project id but it says project-id is not valid please help me

manikamg commented 5 years ago

please help me sir

ahsankhatri commented 5 years ago

Please make sure you're not using project-id as it is mention in document, you need to copy real-life API key of Firestore in order to run.

ahsankhatri commented 5 years ago

Closing due to inactivity.