Download the PHP package leapocr/leapocr-php without Composer
On this page you can find all versions of the php package leapocr/leapocr-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download leapocr/leapocr-php
More information about leapocr/leapocr-php
Files in leapocr/leapocr-php
Package leapocr-php
Short Description Official PHP SDK for LeapOCR - Transform documents into structured data using AI-powered OCR.
License MIT
Homepage https://www.leapocr.com/
Informations about the package leapocr-php
LeapOCR PHP SDK
Official PHP SDK for LeapOCR - Transform documents into structured data using AI-powered OCR.
Overview
LeapOCR provides enterprise-grade document processing with AI-powered data extraction. This SDK offers a modern PHP interface for local file uploads, remote URL processing, job polling, and result retrieval.
Installation
Quick Start
Prerequisites
- PHP 8.2 or higher
- LeapOCR API key (sign up here)
Basic Example
Key Features
- Idiomatic PHP API - Enums, immutable value objects, and exception mapping for the public SDK surface
- Generated from the live API spec - Uses the real OpenAPI document from the running API
- SDK-only public surface - Generates and exposes only operations tagged for the SDK
- Direct file upload support - Handles presigned multipart upload flow for local files
- Polling helpers - Wait for completion with a single method call
- Structured and markdown output - Use templates or direct processing options
- Webhook verification helper - Verify incoming
X-R2-Signatureheaders with the raw request body
Processing Models
Use Model::STANDARD_V2 or Model::PRO_V2, or pass a custom model string through ProcessOptions.
Usage Examples
Processing a Local File
Waiting for Completion
Using a Template
Getting Status and Results Separately
For more runnable samples, see examples/.
Output Formats
| Format | Description | Use Case |
|---|---|---|
Format::STRUCTURED |
Single JSON object | Extract specific fields across the document |
Format::MARKDOWN |
Text per page | Convert a document into readable OCR text |
Configuration
Error Handling
The SDK throws typed exceptions for the public API:
AuthenticationExceptionValidationExceptionFileExceptionJobExceptionJobFailedExceptionJobTimeoutExceptionRateLimitExceptionNetworkExceptionApiException
Webhook Signature Verification
Use LeapOCR::verifyWebhookSignature() with the raw request body exactly as received. LeapOCR sends customer webhooks with X-Webhook-Signature and X-Webhook-Timestamp, and signs timestamp . "." . rawBody with your webhook secret.
Do not verify against re-encoded JSON. Use the original body string and timestamp header from the HTTP request.
Development
Tooling
The SDK uses mise for local tooling:
Regenerating the SDK
The generated client is derived from the live API and then filtered down to SDK-tagged operations only:
Running Tests
The integration suite reads LEAPOCR_BASE_URL and also accepts OCR_BASE_URL for parity with the other LeapOCR SDK test setups.
Publishing
Publish the PHP SDK to Packagist. Composer users install it with:
Versions should come from Git tags such as v0.1.0, not from a hard-coded
version field in composer.json.
One-time setup
- Create the public repository at
https://github.com/leapocr/leapocr-php. - Submit that repository on Packagist as
leapocr/leapocr-php. - Optionally add GitHub Actions secrets for explicit Packagist refreshes:
PACKAGIST_USERNAMEPACKAGIST_TOKEN
Releasing
The release workflow will validate the package, run lint and unit tests, build a release archive, create a GitHub release, and notify Packagist when the Packagist secrets are configured.
For the full setup checklist, see .github/PACKAGIST_SETUP.md.
Generation Notes
- The OpenAPI spec is fetched from the running API at
http://localhost:8443/api/v1/docs/openapi.json scripts/filter_sdk_endpoints.pykeeps only SDK-tagged operations and rewrites them to a singleSDKtag- OpenAPI Generator produces the low-level client in
src/Generated - The public PHP API lives in
src
All versions of leapocr-php with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.8
guzzlehttp/psr7 Version ^2.7