PHPackages                             lstables/nativephp-mobile-document-scanner - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. lstables/nativephp-mobile-document-scanner

ActiveNativephp-plugin[PDF &amp; Document Generation](/categories/documents)

lstables/nativephp-mobile-document-scanner
==========================================

Document scanning plugin for NativePHP Mobile

v1.0.2(1mo ago)01↑2900%MITPHPPHP ^8.3

Since Mar 28Pushed 1mo agoCompare

[ Source](https://github.com/lstables/nativephp-mobile-document-scanner)[ Packagist](https://packagist.org/packages/lstables/nativephp-mobile-document-scanner)[ RSS](/packages/lstables-nativephp-mobile-document-scanner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

NativePHP Mobile Document Scanner
=================================

[](#nativephp-mobile-document-scanner)

Native document scanning for NativePHP Mobile apps

Scan physical documents from the camera with automatic edge detection, perspective correction, multi-page support, and PDF output. The same scanner engine used by Apple Notes and Google Drive, wrapped in a clean Laravel facade.

---

Requirements
------------

[](#requirements)

- PHP 8.2+
- NativePHP Mobile 3.x
- iOS 13.0+ (VisionKit — zero additional dependencies)
- Android API 21+ with at least 1.7 GB RAM (ML Kit via Google Play Services)

---

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

[](#installation)

```
composer require lstables/nativephp-mobile-document-scanner
```

Register the plugin with NativePHP:

```
php artisan native:plugin:register lstables/nativephp-mobile-document-scanner
```

---

Usage
-----

[](#usage)

### Basic scan

[](#basic-scan)

```
use lstables\NativeDocumentScanner\Facades\DocumentScanner;

$result = DocumentScanner::scan();

if ($result && $result->hasPages()) {
    // Array of absolute file paths to JPEG pages
    foreach ($result->pages as $path) {
        // upload, store, process...
    }

    // Combined PDF path (if outputPdf was true)
    if ($result->hasPdf()) {
        Storage::put('scans/document.pdf', file_get_contents($result->pdf));
    }
}
```

### Scan to PDF only

[](#scan-to-pdf-only)

```
$pdfPath = DocumentScanner::scanToPdf();

if ($pdfPath) {
    Storage::put('receipts/scan.pdf', file_get_contents($pdfPath));
}
```

### Scan to JPEG pages only

[](#scan-to-jpeg-pages-only)

```
$pages = DocumentScanner::scanToJpegs(maxPages: 3);
```

### Scan a single page

[](#scan-a-single-page)

```
$imagePath = DocumentScanner::scanSinglePage();
```

### Full options

[](#full-options)

```
$result = DocumentScanner::scan(
    maxPages: 10,           // 0 = unlimited
    allowGalleryImport: true,  // Android only — allow importing from photo library
    mode: 'full',           // 'base' | 'filter' | 'full'
    outputPdf: true,        // Include a combined PDF
    outputJpegs: true,      // Include per-page JPEGs
);
```

**Scanning modes:**

ModeWhat it includes`base`Crop, rotate, reorder pages`filter`+ Greyscale, auto-enhancement filters`full`+ ML-powered stain/shadow/finger removal (default)---

Listening to events
-------------------

[](#listening-to-events)

Events fire whether you use the facade or the JS bridge, and are received by your Livewire components:

```
use lstables\NativeDocumentScanner\Events\DocumentScanned;
use lstables\NativeDocumentScanner\Events\DocumentScanCancelled;
use lstables\NativeDocumentScanner\Events\DocumentScanFailed;

#[OnNative(DocumentScanned::class)]
public function onScanned(int $pageCount, array $pages, ?string $pdf): void
{
    // Store, upload, or process scanned files
}

#[OnNative(DocumentScanCancelled::class)]
public function onCancelled(): void
{
    // User tapped Cancel
}

#[OnNative(DocumentScanFailed::class)]
public function onFailed(string $reason): void
{
    // Something went wrong
}
```

---

JavaScript usage
----------------

[](#javascript-usage)

For Livewire + Alpine or SPA setups, use the JS bridge directly:

```
import { scan, scanToPdf, scanToJpegs, scanSinglePage } from 'vendor/lstables/nativephp-mobile-document-scanner/resources/js/documentScanner'

// Full scan
const result = await scan({ maxPages: 5, mode: 'full' })
if (result && !result.cancelled) {
    console.log(result.pages)     // ['/path/to/page_1.jpg', ...]
    console.log(result.pdf)       // '/path/to/document.pdf'
    console.log(result.pageCount) // 5
}

// Just a PDF
const pdfPath = await scanToPdf()

// Just JPEG pages
const pages = await scanToJpegs(3)

// Single page
const page = await scanSinglePage()
```

---

ScanResult
----------

[](#scanresult)

PropertyTypeDescription`pages``string[]`Absolute paths to JPEG files, one per page`pdf``string|null`Absolute path to combined PDF, or null`pageCount``int`Number of pages scanned`hasPages()``bool`Whether any pages were captured`hasPdf()``bool`Whether a PDF was generated`firstPage()``string|null`Path to the first page, or null`toArray()``array`Serialise to plain array---

File locations
--------------

[](#file-locations)

Scanned files are written to the device's temporary/cache directory under `NativeDocumentScanner/`. They persist until the OS clears the cache. Copy them to permanent storage (Laravel's `Storage` facade, or a file upload) before the session ends.

```
$result = DocumentScanner::scanToPdf();

// Move to Laravel storage
Storage::disk('local')->put(
    'documents/scan_' . now()->timestamp . '.pdf',
    file_get_contents($result)
);
```

---

Platform notes
--------------

[](#platform-notes)

### iOS

[](#ios)

- Uses `VNDocumentCameraViewController` from VisionKit — the same scanner as Apple Notes
- No additional dependencies or CocoaPods required
- UI is Apple's — not customisable (this is a system constraint, not a plugin limitation)
- No gallery import available on iOS (camera-only)

### Android

[](#android)

- Uses Google ML Kit Document Scanner API via Google Play Services
- ML models are downloaded centrally — minimal impact on app bundle size
- No camera permission required — handled by Play Services
- Gallery import can be enabled via `allowGalleryImport: true`
- Requires a minimum device RAM of 1.7 GB

---

Changelog
---------

[](#changelog)

### 1.0.0

[](#100)

- Initial release
- VisionKit scanner (iOS)
- ML Kit Document Scanner (Android)
- Facade with `scan()`, `scanToPdf()`, `scanToJpegs()`, `scanSinglePage()`
- `DocumentScanned`, `DocumentScanCancelled`, `DocumentScanFailed` events
- JavaScript bridge library
- Full Pest test suite

---

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

46d ago

PHP version history (2 changes)1.0PHP ^8.2

v1.0.1PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/2775675a2575f636baf76ce3ad2d538ef951b51487744ec434c163edc57d31c4?d=identicon)[lstables](/maintainers/lstables)

---

Top Contributors

[![lstables](https://avatars.githubusercontent.com/u/1168291?v=4)](https://github.com/lstables "lstables (5 commits)")

---

Tags

pdfmobileOCRnativephpdocument-scannervisionkitmlkit

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/lstables-nativephp-mobile-document-scanner/health.svg)

```
[![Health](https://phpackages.com/badges/lstables-nativephp-mobile-document-scanner/health.svg)](https://phpackages.com/packages/lstables-nativephp-mobile-document-scanner)
```

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[vaites/php-apache-tika

Apache Tika bindings for PHP: extracts text from documents and images (with OCR), metadata and more...

1171.5M2](/packages/vaites-php-apache-tika)[webklex/laravel-pdfmerger

Generic PDF merger for Laravel

1422.6M2](/packages/webklex-laravel-pdfmerger)[grofgraf/laravel-pdf-merger

Package for Laravel that merges multiple PDFs into one.

29548.6k](/packages/grofgraf-laravel-pdf-merger)

PHPackages © 2026

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