|
| 1 | +# Google Vision PHP Sample Application |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +This simple command-line application demonstrates how to invoke Google |
| 6 | +Vision API from PHP. |
| 7 | + |
| 8 | +## Build and Run |
| 9 | +1. **Enable APIs** - [Enable the Vision API](https://console.cloud.google.com/flows/enableapi?apiid=vision.googleapis.com) |
| 10 | + and create a new project or select an existing project. |
| 11 | +2. **Download The Credentials** - Click "Go to credentials" after enabling the APIs. Click "New Credentials" |
| 12 | + and select "Service Account Key". Create a new service account, use the JSON key type, and |
| 13 | + select "Create". Once downloaded, set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` |
| 14 | + to the path of the JSON key that was downloaded. |
| 15 | +3. **Clone the repo** and cd into this directory |
| 16 | +``` |
| 17 | + $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples |
| 18 | + $ cd php-docs-samples/vision/api |
| 19 | +``` |
| 20 | +4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md). |
| 21 | + Run `php composer.phar install` (if composer is installed locally) or `composer install` |
| 22 | + (if composer is installed globally). |
| 23 | +5. Run `php vision.php`. The following commands are available: |
| 24 | +``` |
| 25 | + face Detect faces in an image using Google Cloud Vision API |
| 26 | + help Displays help for a command |
| 27 | + label Detect labels in an image using Google Cloud Vision API |
| 28 | + landmark Detect landmarks in an image using Google Cloud Vision API |
| 29 | + list Lists commands |
| 30 | + logo Detect logos in an image using Google Cloud Vision API |
| 31 | + property Detect image proerties in an image using Google Cloud Vision API |
| 32 | + safe-search Detect adult content in an image using Google Cloud Vision API |
| 33 | + text Detect text in an image using Google Cloud Vision API |
| 34 | +``` |
| 35 | +6. Run `php vision.php COMMAND --help` to print information about the usage of each command. |
| 36 | + |
| 37 | +## Contributing changes |
| 38 | + |
| 39 | +* See [CONTRIBUTING.md](../../CONTRIBUTING.md) |
| 40 | + |
| 41 | +## Licensing |
| 42 | + |
| 43 | +* See [LICENSE](../../LICENSE) |
0 commit comments