Download the PHP package laravelsmartocr/laravel-smart-ocr without Composer
On this page you can find all versions of the php package laravelsmartocr/laravel-smart-ocr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravelsmartocr/laravel-smart-ocr
More information about laravelsmartocr/laravel-smart-ocr
Files in laravelsmartocr/laravel-smart-ocr
Package laravel-smart-ocr
Short Description Multi-provider OCR for Laravel — Tesseract, Google Vision, AWS Textract, Azure, Mistral, Claude, OpenAI, PDF. Schema extraction, Markdown/RAG output, smart routing, human review, PII redaction.
License MIT
Informations about the package laravel-smart-ocr
Laravel Smart OCR — Multi-Provider OCR for Laravel
The #1 OCR package for Laravel. Extract text, tables, bounding boxes, and form fields from images, scanned PDFs, invoices, receipts, and contracts — using 9 providers behind a single unified API.
One API. Nine drivers. One normalized result.
Supports Tesseract (free, offline), Google Cloud Vision, AWS Textract, Azure AI Vision, Claude Vision, OpenAI GPT-4o, Mistral OCR, OpenAI-compatible (Ollama/LM Studio), and native PDF text extraction.
Demo
Full feature walkthrough — Simple Text extraction, Batch processing, Multi-language OCR, Document Detection, AI Cleanup, Templates, Workflows, and URL Security.
https://github.com/user-attachments/assets/cf248862-b7cb-4504-8969-4e3745fd0e7c
What You Can Do
Schema Extraction — OCR directly into typed PHP classes
Markdown & RAG Chunks — Feed OCR output to AI / vector stores
PII Redaction — Strip sensitive data before storing or sharing
Document Classification — Auto-detect document type
Table of Contents
- Quick Start
- Free vs Paid Drivers
- Provider Comparison
- Installation
- Configuration
- OCR Providers
- Tesseract (Free, Offline)
- Google Cloud Vision
- AWS Textract
- Azure AI Vision
- Claude Vision
- OpenAI GPT-4o Vision
- PDF Text Extraction
- The OcrResult Object
- Schema Extraction
- Markdown & RAG
- Smart Routing
- PII Redaction & Classification
- Human Review
- Evaluation
- Fluent API
- Table Extraction
- Form Fields Extraction
- Queue Support
- Error Handling
- Templates
- AI Cleanup
- Environment Variables Reference
- Privacy
- Choosing a Driver
- Testing
- Health Check
Quick Start
Switch providers with zero code changes — just update your .env:
Provider Comparison
| Feature | Tesseract | AWS | Azure | Claude | OpenAI | Mistral | Local (Ollama) | ||
|---|---|---|---|---|---|---|---|---|---|
| Free | ✓ | — | — | — | — | — | — | ✓ | ✓ |
| Offline | ✓ | — | — | — | — | — | — | ✓ | ✓ |
| Confidence | float\|null |
float |
float |
float |
null |
null |
null |
null |
null |
| Multi-page PDF | — | ✓ (5p) | ✓ async+S3 | ✓ | — | — | ✓ | — | ✓ |
| Table extraction | basic | — | ✓ structured | — | prompt-based | prompt-based | — | prompt-based | — |
| Bounding boxes | ✓ word | ✓ | ✓ | ✓ | — | — | — | — | — |
| Max file size | unlimited | 20 MB | 5 MB sync | 50 MB | 5 MB | 20 MB | varies | varies | unlimited |
| Languages | 100+ | 100+ | ~12 | 100+ | auto | auto | auto | model-dep | from PDF |
The
Installation
Publish config:
Optional provider dependencies
Install only the SDK for the provider(s) you use:
Azure Vision uses the REST API directly — no extra package needed.
Configuration
config/smart-ocr.php (or .env):
OCR Providers
Tesseract (Free, Offline)
Local OCR via the Tesseract binary. No API key, no cost, works offline.
Confidence: Tesseract does not expose a reliable per-document confidence score through this driver.
$result->confidence()returnsnull.
Install:
Config:
Usage:
Supported formats: jpg, jpeg, png, tiff, bmp
Google Cloud Vision
Uses Google's Document Text Detection API. Excellent for complex layouts, multi-language documents, and printed text.
Install:
Config:
Usage:
Supported formats: jpg, jpeg, png, gif, bmp, webp, tiff, pdf
Max file size: 20 MB
AWS Textract
Best-in-class for structured documents — invoices, forms, tables. Automatically uses async processing for files over 5 MB.
Install:
Config:
Usage:
Supported formats: jpg, jpeg, png, pdf, tiff
Sync limit: 5 MB (auto-upgrades to async + S3 above this)
Azure AI Vision
Uses the Azure Computer Vision Read API (v3.2 / v4.0). Excellent multi-language support and high accuracy on printed documents.
No extra package needed — uses the built-in HTTP client.
Config:
Usage:
Supported formats: jpg, jpeg, png, bmp, tiff, pdf
Max file size: 50 MB
Claude Vision
Uses Anthropic's Claude models with vision capability. Excellent for complex unstructured documents and natural language understanding.
Confidence: Claude does not return a per-element confidence score.
$result->confidence()returnsnullfor this driver.
Config:
Usage:
Supported formats: jpg, jpeg, png, gif, webp
Max file size: 5 MB
OpenAI GPT-4o Vision
Uses OpenAI's GPT-4o vision capabilities.
Confidence: OpenAI Vision does not return a per-element confidence score.
$result->confidence()returnsnullfor this driver.
Config:
Usage:
Supported formats: jpg, jpeg, png, gif, webp
Max file size: 20 MB
PDF Text Extraction
This is not an OCR engine. It reads the text layer already embedded in a digital PDF using
smalot/pdfparser. No image recognition is performed, so it cannot process scanned documents or image-based PDFs.
Usage:
When to use: The document was exported from Word, Excel, or a similar tool (text is selectable in a PDF viewer).
When NOT to use: The document is a scan, a photo, or any PDF where text cannot be selected. Use Tesseract, Google, AWS, or Azure instead.
The OcrResult Object
All providers return the same OcrResult object:
toArray() schema
Bounding box format
Every word, line, and block has a normalized bounding box:
Schema Extraction
Extract structured data directly into a typed PHP class:
Works free with the rules engine (regex/keyword). Set SMART_OCR_EXTRACTION_ENGINE=llm to use an LLM.
Markdown & RAG
Smart Routing
PII Redaction & Classification
Human Review
Publish the migration and run it:
Then flag low-confidence fields for review:
Evaluation
Test driver accuracy against expected outputs:
Free vs Paid Drivers
| Driver | Cost | Needs API key | Offline |
|---|---|---|---|
tesseract |
Free | No | ✓ |
pdf |
Free | No | ✓ |
openai_compatible |
Free (local model) | No | ✓ with Ollama |
google |
Pay per page | Yes | — |
aws |
Pay per page | Yes | — |
azure |
Pay per page | Yes | — |
mistral |
Pay per page | Yes | — |
claude |
Pay per token | Yes | — |
openai |
Pay per token | Yes | — |
The default driver is tesseract. New users get results immediately, with no account or payment.
Fluent API
The driver() method returns a fluent builder:
Table Extraction
Output structure:
Table extraction is supported by AWS Textract (structured) and basic parsing for Tesseract/PDF. Google and Azure return
[].
Form Fields Extraction
AWS Textract automatically detects key-value pairs in forms:
Queue Support
Dispatch OCR jobs to the Laravel queue:
The job class LaravelSmartOCR\Jobs\ProcessOcrJob implements ShouldQueue with 3 retries and 300s timeout.
Error Handling
All provider errors are wrapped in package-level exceptions:
Retry behavior
Cloud drivers automatically retry on:
- Rate limit errors (respects
Retry-After) - Timeout errors (exponential backoff)
- Transient network errors
They do not retry on:
- Authentication errors
- Unsupported document format
- Invalid documents
Templates
Extract structured fields from document templates:
AI Cleanup
Post-process extracted text with an AI model to correct OCR errors:
Environment Variables Reference
Privacy
Cloud and LLM drivers (Google, AWS, Azure, Claude, OpenAI) send your document contents to third-party APIs. For sensitive documents, use the Tesseract or PDF drivers, which process everything locally.
Configure which providers are allowed:
Choosing a Driver
| Use case | Recommended driver |
|---|---|
| Forms, tables, structured data | aws (Textract) |
| Multilingual printed text | google or azure |
| Offline / private documents | tesseract or pdf |
| Messy layouts, handwriting | claude or openai* |
| PDF with embedded text | pdf |
*LLM drivers can silently correct, reorder, or invent text. Do not rely on them for legally-required verbatim accuracy without human review.
Testing
Use SmartOCR::fake() to swap in a fake driver during tests:
Health Check
Reports: Tesseract binary and version, installed language packs, Ghostscript, and cloud driver credential status.
Keywords
Laravel OCR, PHP OCR package, Laravel text extraction, invoice OCR Laravel, PDF text extraction Laravel, AWS Textract Laravel, Google Cloud Vision Laravel, Azure OCR Laravel, Tesseract Laravel, OpenAI vision Laravel, Claude vision Laravel, Mistral OCR Laravel, Laravel document processing, extract text from image Laravel, OCR package Composer, Laravel invoice parsing, form field extraction Laravel, table extraction Laravel, PII redaction Laravel, document classification Laravel, RAG chunks Laravel, Laravel AI document processing, multi-provider OCR PHP, offline OCR Laravel, Laravel 11 OCR, Laravel 12 OCR
License
MIT — see LICENSE
All versions of laravel-smart-ocr with dependencies
ext-curl Version *
ext-fileinfo Version *
ext-json Version *
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
smalot/pdfparser Version ^2.0