PHPackages                             laravelsmartocr/laravel-smart-ocr - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. laravelsmartocr/laravel-smart-ocr

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

laravelsmartocr/laravel-smart-ocr
=================================

Laravel Smart OCR &amp; Document Data Extractor - A powerful OCR and document parsing engine for Laravel

48PHP

Since Aug 31Pushed 9mo agoCompare

[ Source](https://github.com/niravpatel143/laravel-smart-ocr-package)[ Packagist](https://packagist.org/packages/laravelsmartocr/laravel-smart-ocr)[ RSS](/packages/laravelsmartocr-laravel-smart-ocr/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Smart OCR &amp; Document Data Extractor
===============================================

[](#laravel-smart-ocr--document-data-extractor)

A powerful Laravel package for OCR and intelligent document parsing with AI-powered data cleanup, reusable templates, and multi-language support.

Features
--------

[](#features)

- **Multi-Driver OCR Support**: Tesseract (offline), Google Vision, AWS Textract, Azure OCR
- **Template Matching System**: Create and share reusable document templates
- **AI-Powered Cleanup**: Automatic typo correction and data structuring
- **Multi-Language Support**: Extract text in multiple languages
- **Laravel Native**: Seamless integration with Eloquent, Queues, and Blade
- **Privacy-First**: Full offline capability for sensitive documents
- **Smart Data Extraction**: Automatically extract dates, amounts, emails, phone numbers
- **Document Preview**: Interactive Blade components for reviewing extracted data

Installation
------------

[](#installation)

```
composer require laravelsmartocr/laravel-smart-ocr
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=smart-ocr-config
```

Run migrations:

```
php artisan migrate
```

Basic Usage
-----------

[](#basic-usage)

### Simple OCR Extraction

[](#simple-ocr-extraction)

```
use LaravelSmartOCR\Facades\SmartOCR;

// Extract text from an image
$result = SmartOCR::extract('path/to/document.jpg');

// Extract with specific language
$result = SmartOCR::extract('path/to/document.jpg', [
    'language' => 'spa' // Spanish
]);
```

### Using Templates

[](#using-templates)

```
// Extract using a specific template
$result = SmartOCR::extractWithTemplate('invoice.pdf', $templateId);

// Auto-detect template
$parser = app('smart-ocr.parser');
$result = $parser->parse('invoice.pdf', [
    'auto_detect_template' => true
]);
```

### AI Cleanup

[](#ai-cleanup)

```
$parser = app('smart-ocr.parser');
$result = $parser->parse('receipt.jpg', [
    'use_ai_cleanup' => true,
    'document_type' => 'receipt'
]);
```

### Creating Templates

[](#creating-templates)

```
$templateManager = app('smart-ocr.templates');

$template = $templateManager->create([
    'name' => 'Standard Invoice',
    'type' => 'invoice',
    'fields' => [
        [
            'key' => 'invoice_number',
            'label' => 'Invoice Number',
            'type' => 'string',
            'pattern' => '/Invoice\s*#?\s*:\s*([A-Z0-9\-]+)/i',
        ],
        [
            'key' => 'total_amount',
            'label' => 'Total Amount',
            'type' => 'currency',
            'pattern' => '/Total\s*:\s*\$?\s*([0-9,.]+)/i',
        ]
    ]
]);
```

### Batch Processing

[](#batch-processing)

```
$documents = [
    'invoice1.pdf',
    'invoice2.jpg',
    'receipt.png'
];

$results = $parser->parseBatch($documents, [
    'use_ai_cleanup' => true,
    'save_to_database' => true
]);
```

Blade Components
----------------

[](#blade-components)

Display extracted document data with the included Blade component:

```

```

Advanced Configuration
----------------------

[](#advanced-configuration)

### Configure OCR Drivers

[](#configure-ocr-drivers)

```
# Tesseract (Default - Offline)
SMART_OCR_DRIVER=tesseract
TESSERACT_LANGUAGE=eng

# Google Vision
SMART_OCR_DRIVER=google_vision
GOOGLE_VISION_KEY_FILE=/path/to/credentials.json
GOOGLE_VISION_PROJECT_ID=your-project-id

# AWS Textract
SMART_OCR_DRIVER=aws_textract
AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret
AWS_DEFAULT_REGION=us-east-1

# Azure OCR
SMART_OCR_DRIVER=azure
AZURE_OCR_ENDPOINT=https://your-resource.cognitiveservices.azure.com/
AZURE_OCR_KEY=your-key
```

### Enable AI Cleanup

[](#enable-ai-cleanup)

```
SMART_OCR_AI_CLEANUP=true
SMART_OCR_AI_PROVIDER=openai
OPENAI_API_KEY=your-openai-key
```

### Queue Processing

[](#queue-processing)

```
SMART_OCR_QUEUE_ENABLED=true
SMART_OCR_QUEUE_NAME=ocr-processing
```

Workflows
---------

[](#workflows)

Define custom workflows for specific document types:

```
// config/smart-ocr.php
'workflows' => [
    'invoice' => [
        'options' => [
            'use_ai_cleanup' => true,
            'auto_detect_template' => true,
            'extract_tables' => true,
        ],
        'post_processors' => [
            ['class' => 'App\OCR\Processors\InvoiceProcessor'],
        ],
    ],
]

// Usage
$result = $parser->parseWithWorkflow('invoice.pdf', 'invoice');
```

API Usage
---------

[](#api-usage)

```
// Field mapping with fuzzy matching
$aiCleanup = app('smart-ocr.ai-cleanup');
$mapped = $aiCleanup->mapFields($extractedData, [
    'invoice_id' => [
        'alternatives' => ['invoice_number', 'inv_no', 'bill_number'],
        'transform' => 'uppercase'
    ],
    'amount' => [
        'field' => 'total',
        'transform' => 'currency'
    ]
]);
```

Security
--------

[](#security)

- **Offline Mode**: Use Tesseract for complete data privacy
- **Encryption**: Enable data encryption for stored documents
- **Validation**: Built-in MIME type and file size validation
- **Sanitization**: Automatic input sanitization

Pro Version
-----------

[](#pro-version)

Upgrade to Pro for:

- Advanced AI cleanup with multiple providers
- Access to community template marketplace
- Priority support and updates
- Advanced language packs
- Custom OCR model training s

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance40

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b1da9c6278144d942bacc8ee59e21c4b82543388c8008c52b98c2d5a49ed86c?d=identicon)[Nirav Goriya](/maintainers/Nirav%20Goriya)

---

Top Contributors

[![niravpatel143](https://avatars.githubusercontent.com/u/70512652?v=4)](https://github.com/niravpatel143 "niravpatel143 (2 commits)")

### Embed Badge

![Health badge](/badges/laravelsmartocr-laravel-smart-ocr/health.svg)

```
[![Health](https://phpackages.com/badges/laravelsmartocr-laravel-smart-ocr/health.svg)](https://phpackages.com/packages/laravelsmartocr-laravel-smart-ocr)
```

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19037.7M41](/packages/mck89-peast)[karriere/json-decoder

JsonDecoder implementation that allows you to convert your JSON data into PHP class objects

140439.4k12](/packages/karriere-json-decoder)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

46143.1k6](/packages/jstewmc-rtf)[json-mapper/laravel-package

The JsonMapper package for Laravel

25188.9k3](/packages/json-mapper-laravel-package)[moonshine/layouts-field

Field for repeating groups of fields for MoonShine

107.9k](/packages/moonshine-layouts-field)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
