nfreear / cloudsight-http-client
HTTP client for CloudSight's image recognition API. (Not endorsed by CloudSight.)
Installs: 5 000
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 5
Requires
- php: >=5.3.2
- net/http: 1.1.*
Requires (Dev)
- jakub-onderka/php-parallel-lint: ~0.8
- silex/silex: 1.2.*
- squizlabs/php_codesniffer: ~2.1.0
- vlucas/phpdotenv: 1.1.*@dev
This package is not auto-updated.
Last update: 2024-11-09 18:27:22 UTC
README
cloudsight-http-client
PHP HTTP client library for the CloudSight image recognition API, with mock API functionality.
Installation
Install using Composer, via Packagist. At the commandline / in a terminal, type:
composer require nfreear/cloudsight-http-client:dev-master
Usage
-
Register with CloudSight to get an API key.
-
At the commandline / in a terminal, type:
composer copy-env
- Edit the
CS_API_KEY
variable, in theexample/.env
configuration file, using your favourite text editor:
atom example/.env
- Try the command line example:
composer example
- And, a web server based example:
composer web
Note: you'll want to set the CS_MOCK
variable to false
, to run live demos!
Legacy
<?php use Nfreear\Cloudsight\Cloudsight_Http_Client; $client = new CloudSight_Http_Client($api_key); $request = $client->postImageRequests($image_url); while (1) { sleep(1); $result = $client->getImageResponses($request->token); // Check if analysis is complete. if ($client->isComplete()) { break; } } echo "Complete. ALT text: " . $result->name; ?>
NOTE: this library is NOT endorsed by CloudSight.
© 2016 Nick Freear. License: MIT.