shoop79
shoop79

Reputation: 1

Google Cloud Document AI namespace issue

I'm currently working on a project that involves using the Google Cloud Document AI Client Library in my PHP application.

However, I've encountered an issue with the library's namespace that's been causing some trouble.

The Problem: The official documentation for the Google Cloud Document AI Client Library specifies the following namespace: Google\Cloud\DocumentAI\V1

As I understand, this is consistent with the usual naming conventions for Google Cloud libraries. However, when I try to check this namespace is correct using the following

class_exists('Google\Cloud\DocumentAI\V1\DocumentServiceClient')

The above returns false.

Can anyone help me understand why I might be encountering this issue and how to resolve it? Any suggestions you can share would be greatly appreciated.

What I've Tried: I have double-checked the library installation, and it appears to be correctly installed in my project's vendor directory. I have tried V1beta3 instead of V1 I have cleared any cached files using composer dump-autoload, but the issue persists.

Upvotes: 0

Views: 130

Answers (1)

Holt Skinner
Holt Skinner

Reputation: 2234

Have you tried using the official quickstart Code Sample for PHP with Document AI?

https://cloud.google.com/document-ai/docs/process-documents-client-libraries#client-libraries-usage-php

Depending on how the library was installed, you might need to run this at the beginning to load composer installed libraries.

# Includes the autoloader for libraries installed with composer
require __DIR__ . '/vendor/autoload.php';

Upvotes: 0

Related Questions