thangman22/google-cloud-vision-php

此包的最新版本(1.02)没有可用的许可信息。

1.02 2016-12-24 04:19 UTC

This package is not auto-updated.

Last update: 2024-09-20 20:31:31 UTC


README

Build Status

GoogleCloudVisionPHP

此项目托管了各种基于RESTful的Google Cloud Vision API的PHP库 [了解Google Cloud Vision API](https://cloud.google.com/vision/)

##功能

  • 支持Google Cloud Vision API(版本1)的几乎所有功能
  • 自动将图片编码为base64

##如何获取服务密钥 Google Cloud Vision API文档

##要求

  • PHP >= 5.4,并带有cURL扩展

##安装 将以下内容添加到您的composer.json中

"require": {
        "thangman22/google-cloud-vision-php": "*"
    }

##示例

use GoogleCloudVisionPHP\GoogleCloudVision;

$gcv = new GoogleCloudVision();

// Follow instruction from Google Cloud Vision Document
$gcv->setKey("[Key from Google]");

$gcv->setImage("[File path]");

// 1 is Max result
$gcv->addFeature("LABEL_DETECTION", 1);

$gcv->addFeatureUnspecified(1);
$gcv->addFeatureFaceDetection(1);
$gcv->addFeatureLandmarkDetection(1);
$gcv->addFeatureLogoDetection(1);
$gcv->addFeatureLabelDetection(1);
$gcv->addFeatureOCR(1);
$gcv->addFeatureSafeSeachDetection(1);
$gcv->addFeatureImageProperty(1);

//Optinal
$gcv->setImageContext(array("languageHints"=>array("th")));

$response = $gcv->request();