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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-smart-ocr

Laravel Smart OCR — Multi-Provider OCR for Laravel

Latest Stable Version Total Downloads License PHP Laravel Version

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

Switch providers with zero code changes — just update your .env:


Provider Comparison

Feature Tesseract Google AWS Azure Claude OpenAI Mistral Local (Ollama) PDF
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 pdf driver extracts text already embedded in a digital PDF — it is not an OCR engine and cannot read scanned or image-based documents.


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() returns null.

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() returns null for 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() returns null for 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:

They do not retry on:


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

PHP Build Version
Package Version
Requires php Version ^8.0
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
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laravelsmartocr/laravel-smart-ocr contains the following files

Loading the files please wait ...