0

I'd like to use the Google Cloud Vision API with PHP. Inside my www directory I executed the following command line:

composer require google/cloud

So now inside www I have a vendor/ directory which has the following files/directories:

autoload.php, bin, composer, firebase, google, grpc, guzzlehttp, monolog, paragonie, psr, ramsey, rize

I'd like now to use the Google Vision API in PHP, following this tutorial:

https://cloud.google.com/vision/docs/detecting-web?authuser=1#vision-web-detection-php

But I'm getting:

Uncaught Error: Class 'Cloud\Vision\VisionClient' not found in

I tried to add "vendor" when I'm defining the namespace (as my Google files are under vendor)

namespace vendor\Google\Cloud\Samples\Vision;

But it didn't help.

starbeamrainbowlabs
  • 5,692
  • 8
  • 42
  • 73
woshitom
  • 4,811
  • 8
  • 38
  • 62
  • `require('$path_to/vendor/autoload.php');` – Sammitch Jan 31 '18 at 18:40
  • @Sammitch I just added it but i unfortunately still got Class 'Cloud\Vision\VisionClient' not found – woshitom Jan 31 '18 at 18:47
  • Your error message implies you're using `Cloud\Vision\VisionClient` instead of `Google\Cloud\Vision\VisionClient`. `vendor` will never be part of any namespace. It's tough to provide any more comprehensive advice on your code seeing as you've not posted any of it. – Sammitch Jan 31 '18 at 19:08
  • @Sammitch working now, thank you sir! – woshitom Jan 31 '18 at 19:33

0 Answers0