Download the PHP package php-vision/ya-ocr-sdk without Composer
On this page you can find all versions of the php package php-vision/ya-ocr-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download php-vision/ya-ocr-sdk
More information about php-vision/ya-ocr-sdk
Files in php-vision/ya-ocr-sdk
Package ya-ocr-sdk
Short Description HTTP client for Yandex Cloud Vision OCR (sync/async)
License MIT
Informations about the package ya-ocr-sdk
Yandex Cloud Vision OCR PHP Client
HTTP client for Yandex Cloud Vision OCR (sync + async). Designed as a small, predictable, PSR-friendly Composer library with clear errors, DTOs, and optional concurrency via a runner interface.
Features
- Sync OCR (
recognizeText) - Async OCR (
startTextRecognition+ polling withwait/waitMany) - PSR-18 transport + PSR-17 factories
- Deterministic DTOs with raw payload/meta
- Typed exceptions
- No hard dependency on event loops (optional concurrency via runner)
Requirements
- PHP 8.4+
- PSR-18 HTTP client
- PSR-17 factories
Installation
You must also install a PSR-18 client and PSR-17 factories, for example:
Authentication
Two options:
- IAM Token
UseAuthorization: Bearer <IAM_TOKEN>. - API Key
UseAuthorization: Api-Key <API_KEY>(nofolderIdheader).
This library only signs requests and forwards headers; it does not call IAM endpoints.
Quick Start (Sync)
Async OCR (Start + Poll)
Options
Every OCR call accepts an OcrOptions object:
languageCodes(array ofLanguageCodeenums)model(OcrModelenum, default ispage)requestId(string, forwarded asx-request-id)
Concurrency (waitMany)
waitMany() uses a runner to execute waits. Default is sequential:
You can provide a custom runner that performs concurrent execution.
Multi-page Documents
For some multi-page OCR responses, the API may return NDJSON/JSONL (one JSON object per line, one line per page).
The client parses this automatically and returns:
Error Handling
Exceptions are thrown for common failures:
ApiException— non-2xx responses or operation errorsHttpException— transport failuresValidationException— invalid input or JSONTimeoutException— async polling timed out
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
All versions of ya-ocr-sdk with dependencies
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^2.0
ext-fileinfo Version *