PHP code example of pkboom / google-vision

1. Go to this page and download the library: Download pkboom/google-vision 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/ */

    

pkboom / google-vision example snippets


use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->text($imagePath);

// statically
use Pkboom\GoogleVision\Facades\GoogleVision;

GoogleVision::face($imagePath);

return [
    /*
     * Path to the json file containing the credentials.
     */
    'service_account_credentials_json' => storage_path('app/service-account/credentials.json'),
];

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->text($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->logo($imagePath);

// with extension
$result = $googleVision->logo($imagePath, $imageExtension);

// with file output
$result = $googleVision
    ->output($outputFilePath);
    ->logo($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->cropHints($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->document($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->face($imagePath, $extension, $outputPath);

// with extension
$result = $googleVision->face($imagePath, $imageExtension);

// with file output
$result = $googleVision
    ->output($outputFilePath);
    ->face($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->imageProperty($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->label($imagePath);


use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->landmark($imagePath);

// with extension
$result = $googleVision->landmark($imagePath, $imageExtension);

// with file output
$result = $googleVision
    ->output($outputFilePath);
    ->landmark($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->object($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->safeSearch($imagePath);

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->web($imagePath);

// with geo results
$result = $googleVision
    ->

use Pkboom\GoogleVision\GoogleVisionFactory;

$path = 'gs://your-bucket/file.pdf';
$output = 'gs://your-bucket/any/';

$googleVision = GoogleVisionFactory::create();

$googleStorage->pdf($path, $output);

// with destination
$googleStorage
    ->to($output)
    ->pdf($path, $output);
bash
php artisan vendor:publish --provider="Pkboom\GoogleVision\GoogleVisionServiceProvider"