1. Go to this page and download the library: Download razmik/yandex-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/ */
razmik / yandex-vision example snippets
// Создание стандартного экземпляра HTTP клиента
$client = new YandexVisionApiClient('<token>', '<folderId>');
$yandexVision = new YandexVision($client);
// Документ на отправку
$document = new ImageDocument('./passport.jpg');
// Модель паспорта для распознавания
$model = new PassportModel();
// Получение данных
$results = $vision->getDetectedText($document, $model);
...
// Модель определения качества
$model = new QualityModel();
// Получение данных
$result = $vision->getClassifiedProperties($document, $model);
...
// Модель обнаружение лиц
$model = new FaceDetectionModel();
// Получение данных
$results = $vision->getFaceCoordinates($document, $model);
// Создание своего хранилища
class MyStorage implements IAMTokenStorageInterface
{
...
}
$storage = new MyStorage();
// Смена хранилища
$yandexVision = new YandexVision($client);
$yandexVision->setIamTokenStorage($storage);
// Задать время хранения IAM токена в секундах
IAMToken::$expiredAt = 4 * 3600;
// Создание своего HTTP клиента
class MyHTTPClient extends AbstractYandexVisionApiClient
{
...
}
$client = new MyHTTPClient();
// Использование HTTP клиента
$yandexVision = new YandexVision($client);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.