1. Go to this page and download the library: Download php-vision/ya-ocr-sdk 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/ */
php-vision / ya-ocr-sdk example snippets
declare(strict_types=1);
use GuzzleHttp\Client as GuzzleClient;
use Nyholm\Psr7\Factory\Psr17Factory;
use PhpVision\YandexVision\Auth\ApiKeyCredentialProvider;
use PhpVision\YandexVision\Ocr\Enum\LanguageCode;
use PhpVision\YandexVision\Ocr\OcrOptions;
use PhpVision\YandexVision\Ocr\OcrService;
use PhpVision\YandexVision\Transports\HttpTransport;
odes(LanguageCode::RU, LanguageCode::EN);
$response = $ocr->recognizeText($bytes, 'image/png', $options);
var_dump($response->getPayload());
declare(strict_types=1);
use GuzzleHttp\Client as GuzzleClient;
use Nyholm\Psr7\Factory\Psr17Factory;
use PhpVision\YandexVision\Auth\ApiKeyCredentialProvider;
use PhpVision\YandexVision\Ocr\OcrService;
use PhpVision\YandexVision\Transports\HttpTransport;
le = $ocr->startTextRecognitionFromFile(__DIR__ . '/image.png');
$result = $ocr->wait($handle->getOperationId(), 60);
var_dump($result->getPayload());
$results = $ocr->waitMany(['op-1', 'op-2'], 60);
$payload = $response->getPayload();
$pages = $payload['pages']; // array of page objects in API order
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.