PHPackages                             jake142/receiptscanner - 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. [API Development](/categories/api)
4. /
5. jake142/receiptscanner

ActiveLibrary[API Development](/categories/api)

jake142/receiptscanner
======================

ReceiptScanner is a Laravel AI provider wrapper for scanning receipt images and PDFs into structured receipt JSON via OpenAI, Azure OpenAI, Gemini, and Anthropic provider APIs.

0.1.11(1mo ago)1279↑166.7%MITPHPPHP ^8.3

Since May 26Pushed 1mo agoCompare

[ Source](https://github.com/jake142/receiptscanner)[ Packagist](https://packagist.org/packages/jake142/receiptscanner)[ RSS](/packages/jake142-receiptscanner/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (13)Used By (0)

ReceiptScanner by Packr
=======================

[](#receiptscanner-by-packr)

ReceiptScanner is a small Laravel package for extracting structured receipt data from images and PDFs using upstream AI providers.

It is a wrapper around multimodal LLM APIs. It does not host its own OCR service, database, queue, UI, or REST API.

Features
--------

[](#features)

- Laravel facade entry point: `Jake142\ReceiptScanner\Facades\ReceiptScanner`
- Public methods:
    - `ReceiptScanner::scanImages(array $images): array`
    - `ReceiptScanner::scanPdf(mixed $pdf): array`
- Supports multi-image receipt analysis in a single upstream request
- Supports PDF receipt analysis from one input file
- Provider selection via config/env
- Default provider models:
    - OpenAI: `gpt-5.4-nano`
    - Azure OpenAI: `gpt-5.4-nano`
    - Gemini: `gemini-2.5-pro`
    - Anthropic: `claude-sonnet-4-20250514`
- Configurable output fields to reduce prompt size and response size
- Safe logging controls

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

[](#requirements)

- PHP `^8.3`
- Laravel `illuminate/support` `^11.0|^12.0|^13.0`
- Laravel `illuminate/http` `^11.0|^12.0|^13.0`
- For development and testing:
    - `orchestra/testbench` `^9.0|^10.0|^11.0`

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

[](#installation)

```
composer require jake142/receiptscanner
```

Publish the config file:

```
php artisan vendor:publish --tag=receiptscanner-config
```

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

[](#configuration)

ReceiptScanner is configured through `config/receipt-scanner.php` and environment variables.

### Environment variables

[](#environment-variables)

```
RECEIPT_SCANNER_PROVIDER=openai
RECEIPT_SCANNER_TIMEOUT=60
RECEIPT_SCANNER_MAX_RETRIES=2
RECEIPT_SCANNER_PROMPT_LANGUAGE=en

OPENAI_API_KEY=
OPENAI_MODEL=gpt-5.4-nano

AZURE_OPENAI_API_KEY=
AZURE_OPENAI_ENDPOINT=
AZURE_OPENAI_DEPLOYMENT=gpt-5.4-nano
AZURE_OPENAI_MODEL=gpt-5.4-nano

GEMINI_API_KEY=
GEMINI_MODEL=gemini-2.5-pro

ANTHROPIC_API_KEY=
ANTHROPIC_MODEL=claude-sonnet-4-20250514
```

### Config shape

[](#config-shape)

The package config exposes these keys:

- `default_provider`
- `providers.openai.api_key`
- `providers.openai.model`
- `providers.azure_openai.api_key`
- `providers.azure_openai.endpoint`
- `providers.azure_openai.deployment`
- `providers.azure_openai.model`
- `providers.gemini.api_key`
- `providers.gemini.model`
- `providers.anthropic.api_key`
- `providers.anthropic.model`
- `timeout`
- `max_retries`
- `enabled_fields`
- `prompt_language`

### Default output fields

[](#default-output-fields)

By default, all fields are enabled:

- `merchant`
- `total_amount`
- `currency`
- `date`
- `vat_amount`
- `mcc`
- `vats`
- `line_items`
- `confidence`
- `tip`
- `purchase_country`
- `purchase_city`

You can disable parts of the response in config to reduce prompt size and response size. For example, if you do not need VAT breakdowns, set `enabled_fields.vats` to `false`.

Usage
-----

[](#usage)

### Scan multiple images

[](#scan-multiple-images)

Use `scanImages()` when a receipt is split across several photos.

```
use Jake142\ReceiptScanner\Facades\ReceiptScanner;

$result = ReceiptScanner::scanImages([
    storage_path('app/receipts/receipt-part-1.jpg'),
    storage_path('app/receipts/receipt-part-2.jpg'),
]);
```

The images are analyzed together as one receipt. This is useful when the top and bottom of a long receipt were captured in separate photos.

### Scan a PDF

[](#scan-a-pdf)

Use `scanPdf()` for a single PDF input.

```
use Jake142\ReceiptScanner\Facades\ReceiptScanner;

$result = ReceiptScanner::scanPdf(storage_path('app/receipts/receipt.pdf'));
```

Result format
-------------

[](#result-format)

`$result` is a JSON-compatible associative array. The package asks the upstream model to return strict JSON only.

Default output shape:

```
[
    'merchant' => null,
    'total_amount' => null,
    'currency' => null,
    'date' => null,
    'vat_amount' => null,
    'mcc' => null,
    'vats' => [
        [
            'rate' => null,
            'amount' => null,
            'amount_inc_vat' => null,
            'amount_ex_vat' => null,
        ],
    ],
    'line_items' => [
        [
            'description' => null,
            'quantity' => null,
            'unit_price' => null,
            'amount' => null,
        ],
    ],
    'confidence' => null,
    'tip' => null,
    'purchase_country' => null,
    'purchase_city' => null,
]
```

Notes:

- `vats` is always an array.
- `line_items` is always an array.
- Unknown scalar values are returned as `null`.
- Unknown arrays are returned as `[]`.
- Dates are normalized to `YYYY-MM-DD` when possible.
- Numeric values are normalized to numbers, not strings, when possible.
- `mcc` is AI-estimated because receipts usually do not contain MCC directly.
- `tip` is a numeric tip/gratuity amount when visible on the receipt; otherwise `null`.
- `purchase_country` is the purchase country when inferable from receipt text, merchant/address, currency, or visible location; otherwise `null`.
- `purchase_city` is the purchase city when visible or clearly inferable from receipt text/address; otherwise `null`.

Provider selection
------------------

[](#provider-selection)

Set the provider and model in env, then load them through config.

Example:

```
RECEIPT_SCANNER_PROVIDER=openai
OPENAI_MODEL=gpt-5.4-nano
```

Azure OpenAI is supported as well. When using Azure OpenAI, configure the Azure provider settings and use the OpenAI `gpt-5.4-nano` model/deployment.

Logging
-------

[](#logging)

If logging is enabled, the package may log safe diagnostics such as provider, model, mime type, retry count, duration, and failure category.

It will not log API keys, raw receipt contents, extracted JSON values, or full base64 payloads.

Error handling
--------------

[](#error-handling)

The package throws `Jake142\ReceiptScanner\Exceptions\ReceiptScannerException` for configuration, input, upstream, and parsing failures.

Testing
-------

[](#testing)

No tests are included in this package.

Disclaimer
----------

[](#disclaimer)

ReceiptScanner uses upstream AI providers to interpret receipts. It does not guarantee accounting accuracy. Always review critical financial data before using it in production workflows.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance89

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

12

Last Release

57d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a6a9a8792905b18b2f694e7c6ca4455081041b24e20f467ec77a94ed65885a4?d=identicon)[jake142](/maintainers/jake142)

---

Top Contributors

[![jake142](https://avatars.githubusercontent.com/u/4847060?v=4)](https://github.com/jake142 "jake142 (26 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jake142-receiptscanner/health.svg)

```
[![Health](https://phpackages.com/badges/jake142-receiptscanner/health.svg)](https://phpackages.com/packages/jake142-receiptscanner)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

813336.8k3](/packages/defstudio-telegraph)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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