I want to use Google Cloud Vision API on a family photo. I activated the API on my GCP account, received an API Key but I don't know where I should insert it. Here's my code :
<?
require 'vendor/autoload.php';
use Google\Cloud\Vision\VisionClient;
$vision = new VisionClient();
$image = $vision->image(
fopen('data/family_photo.jpg', 'r'),
['faces']
);
$annotation = $vision->annotate($image);
var_dump($annotation);
die();
?>
I get the following error : "error": { "code": 403, "message": "The request is missing a valid API key.", "status": "PERMISSION_DENIED" } }.
Update: Thanks to the provided answer by Dan D., I added the following line:
putenv("GOOGLE_APPLICATION_CREDENTIALS=book.json");