This library provides a simple client for Microsoft's Computer Vision API using the Guzzle PHP HTTP client.
- PHP 5.5 or higher
- PHP CURL extension
This library is published as a Composer package, so Composer is the recommended way to install it.
Add computer-vision-client
to your application's composer.json
file:
{
"require": {
"andaris/computer-vision-client": "0.1.0"
}
}
Navigate to your project root and run:
$ composer install
Make sure that the Composer autoloader is in your project's bootstrap.
use Andaris\ComputerVision\Client;
$imageData = file_get_contents('/path/to/image.jpg');
$client = new Client('14758f1afd44c09b7992073ccf00b43d'); // Insert your API key
$result = $client->analyze($imageData, [Client::FEATURE_CATEGORIES, Client::FEATURE_TAGS]);
The PHPUnit test suite can be run via vendor/bin/phpunit
.