Download the PHP package ikromjon/nativephp-mobile-document-scanner without Composer

On this page you can find all versions of the php package ikromjon/nativephp-mobile-document-scanner. 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 nativephp-mobile-document-scanner

NativePHP Mobile Document Scanner

Tests Total Downloads

Scan documents with automatic edge detection, perspective correction, and cropping in your NativePHP Mobile app — powered by native platform APIs.

Quick Start

That's it. The scanner opens, the user scans, and you get the file paths back via events. See below for full options and JavaScript usage.

How It Works

Platform Native API Features
iOS VisionKit (VNDocumentCameraViewController) Auto edge detection, perspective correction, shadow removal, multi-page
Android Google ML Kit Document Scanner Auto edge detection, cropping, rotation, multi-page, gallery import

No external API keys or internet required. Camera permission is handled automatically.

Installation

Build your app (plugin requires a native build):

Note: The scanner requires a native build on a real device — it won't work with php artisan serve. If you call scan() without a native build, you'll see a warning in your Laravel log.

Configuration

Optionally publish the config file:

Key Default Description
default_max_pages 0 Default max pages per scan (0 = unlimited)
max_pages_limit 100 Absolute cap on pages per scan
default_output_format jpeg Default output format (jpeg or pdf)
default_jpeg_quality 90 Default JPEG compression quality (1-100)
storage_directory scanned-documents Subdirectory for scanned files
default_gallery_import false Allow gallery import (Android only)
default_scanner_mode full Scanner mode: base, filter, full (Android only)

Usage (PHP)

Scan a Document

The scan() method opens the native scanner UI and returns immediately. Results are delivered asynchronously via events.

Type-Safe DTO

Scan Parameters

Parameter Type Platform Description
maxPages int Both Max pages to scan (0 = unlimited)
outputFormat OutputFormat|string Both jpeg or pdf
jpegQuality int Both JPEG quality 1-100 (only for jpeg output)
galleryImport bool Android only Allow importing from device gallery
scannerMode ScannerMode|string Android only base, filter, or full

Full Livewire Example

A complete component that scans documents and displays the results:

Important: Use #[OnNative(...)] (not #[On(...)]) for NativePHP events.

Listening to Events (Laravel)

Usage (JavaScript)

Events

Event Payload When
DocumentScanned paths, pageCount, outputFormat Scanning completed successfully
ScanCancelled User cancelled the scanner
ScanFailed error An error occurred
PdfCreated path imagesToPdf() completed

Scanned Files

Scanned files are saved to the app's internal storage under the configured storage_directory (default: scanned-documents). File paths returned in the DocumentScanned event are absolute paths on the device.

Which format to use?

JPEG (default) is the better choice for most apps. You get individual files per page, which means you can show page previews, let users view/delete specific pages, and convert to PDF later on your own terms (e.g. with fpdf). You also control file size via jpegQuality.

PDF is useful when you need a single file immediately and don't need to display or manipulate individual pages. Note that the native scanner produces the PDF directly — you can't extract page previews from it without a separate library.

See Smart Docs for an example that scans as JPEG by default and converts to PDF on demand.

Required Permissions

Android: CAMERA — declared automatically via nativephp.json. ML Kit handles the scanner UI internally.

iOS: VisionKit requests camera access at runtime. Your app's Info.plist must include an NSCameraUsageDescription string — NativePHP sets a default, but you should customize it for your app store submission (e.g. "This app uses the camera to scan documents").

No API keys or internet required.

Demo App

See Smart Docs — a full NativePHP mobile app that uses this plugin for document scanning.

Documentation

JPEG-to-PDF Conversion

Combine scanned JPEG pages into a single PDF on-device — no extra PHP library needed:

Works with any JPEG files, not just scanned documents.

PDF Page Thumbnails

Extract page previews from a PDF — useful when you scan as PDF but need page-level previews:

Planned Features

See ROADMAP.md for full details and status.

Testing

Requirements

License

MIT


All versions of nativephp-mobile-document-scanner with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
nativephp/mobile Version ^3.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 ikromjon/nativephp-mobile-document-scanner contains the following files

Loading the files please wait ...