- Add composer
composer require "yedincisenol/vision"
- Add service provider (For Laravel 5.6 before)
config/app.php
'providers' => [
...
yedincisenol\Vision\LaravelServiceProvider::class
],
- Add Facede
config/app.php
'aliases' => [
...
'Vision' => \yedincisenol\Vision\LaravelFacede::class
],
- Fill Environments
copy theese parameters to your project .env and fill
VISION_CREDENTIALS_PATH=
VISION_API_KEY=
How to get credentials file? Visit here How to get API key? Visit here
- Laravel Usage
use Vision;
$image = Vision::image(file_get_contents('https://cdn.britannica.com/700x450/04/1304-004-E64E228C.jpg'), ['LABEL_DETECTION']);
$results = Vision::annotate($image);
collect(Vision::annotate($image)->labels())->each(function ($l) { echo $l->description() . PHP_EOL; });
For more detail visit here
- Publish Config file (Optional)
php artisan vendor:publish --tag=vision