PHP code example of gdevilbat / google-cloud-vision-php

1. Go to this page and download the library: Download gdevilbat/google-cloud-vision-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gdevilbat / google-cloud-vision-php example snippets

bash
composer 


oogleCloudVision\GoogleCloudVision;
use GoogleCloudVision\Request\AnnotateImageRequest;
use GoogleCloudVision\Request\Request;


$annotateImageRequest1 = new AnnotateImageRequest();
$annotateImageRequest1->setImageUri("https://cdn.pixabay.com/photo/2016/02/19/11/25/supreme-court-building-1209701_960_720.jpg");
$annotateImageRequest1->setFeature('IMAGE_PROPERTIES');
$annotateImageRequest1->setFeature('LABEL_DETECTION');
$annotateImageRequest1->setFeature('WEB_DETECTION');

$gcvRequest = new GoogleCloudVision([$annotateImageRequest1], "Your_api_key");
$response = $gcvRequest->annotate();

echo json_encode($response);