Download the PHP package jkudish/laravel-document-extraction without Composer

On this page you can find all versions of the php package jkudish/laravel-document-extraction. 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-document-extraction

Laravel Document Extraction

Extract text and structured data from your documents using a fluent, Laravel-native API.

Laravel Document Extraction works with PDFs, images, uploads, Laravel Storage, streams, and strings. It can read existing text, use Laravel AI for OCR, and return data that matches a schema you define.

Installation

Install version 0.2 with Composer:

The package requires:

Version 0.2.0 requires Laravel AI 1.x and Laravel 13.30.0 or newer. Applications on Laravel 13.23–13.29 must patch Laravel before upgrading; those versions are affected by CVE-2026-102279.

You may publish the configuration and check your server's native tools:

extraction:doctor is an Artisan command. It checks your environment without contacting an AI provider or uploading a document.

Basic usage

Start with a path, Laravel Storage file, upload, stream, or string:

Each method returns a pending extraction. Finish it with text() or extract().

Extract text

Existing text is read directly. Pages that need OCR use your configured Laravel AI provider.

To disable AI and return only existing text:

Extract structured data

Define the result with Laravel's JSON schema types:

You can also use a reusable Laravel AI agent that implements Agent and HasStructuredOutput:

Detect documents within a PDF

Use detectDocuments() when one PDF may contain several documents:

Document detection has its own provider and model settings. Page assignments are checked locally. Missing, overlapping, or ambiguous pages are reported instead of guessed.

Configuration

Set your default provider and model in .env:

Override them for one extraction when needed:

Publish config/extraction.php to configure:

For the optional OpenRouter setup tested by this project, see the model evaluation guide.

Supported formats

Available image formats depend on your installed Imagick codecs. Run php artisan extraction:doctor in each environment.

The package:

Source safety

The package reads source bytes into a private, bounded snapshot when extraction begins.

Configured storage adapters, stream wrappers, and executables remain trusted application code. Package limits are not a sandbox for hostile extensions.

AI and validation

Application agents keep their instructions, schema, provider options, attributes, and middleware. Agents with tools or saved conversation history are rejected before document content is sent.

Laravel AI 1.x middleware receives a PendingStep, not an AgentPrompt. Forward it with $next($step) and use the returned StepResult to inspect or edit a step's response. Follow the Laravel AI upgrade guide when migrating application middleware from 0.11.

Structured extraction requires a provider path that preserves the original JSON response. OpenAI Responses and Anthropic's native and structured-tool paths are covered by offline fixtures. The current Bedrock structured path is rejected because it cannot preserve that response; Bedrock text and OCR are still supported.

Results

Every result includes:

ExtractionResult provides collections for documents, pages, calls, and errors. It also includes source details, media type, page count, cost summary, and complete().

In document-detection mode, inspect each item in documents. Top-level data and text stay null so the first document is never returned by accident.

Pricing evidence

Call records keep the requested and effective provider and model, duration, outcome, usage, and available quote.

Call usage is native Laravel AI TextUsage: inputTokens includes cache reads and writes, and outputTokens includes reasoning. Optional subset counters remain null when unreported. Serialized usage uses input_tokens and output_tokens, not the former prompt_tokens and completion_tokens keys. Pricing partitions these inclusive totals rather than charging their subsets twice.

Handling errors

Expected page and document failures appear in $result->errors. Always check $result->complete() before treating an extraction as complete.

Source, configuration, preparation, and global AI limit failures throw an ExtractionException:

partialResult contains safe work completed before the failure. It may include pages, documents, calls, costs, and errors. It does not mean the extraction completed.

Testing

Fake the facade to avoid parsing files or contacting a provider:

The fake supports result sequences, callbacks, assertCalled(), and assertNothingCalled(). It also prevents unexpected calls after a configured sequence is exhausted.

Application responsibilities

The package handles document preparation, extraction, validation, and result details. Your application decides:

Our test documents are a useful starting point, but every document set is different. Before relying on the package in production, test it with your own files, schemas, and provider setup, and review the extracted data appropriately for your application.

Contributing

See docs/verification.md.

Report security issues privately using SECURITY.md.

License

Laravel Document Extraction is open-sourced software licensed under the MIT license.


All versions of laravel-document-extraction with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
ext-fileinfo Version *
ext-imagick Version *
ext-mbstring Version *
ext-xmlreader Version *
illuminate/image Version ^13.30
illuminate/json-schema Version ^13.30
illuminate/process Version ^13.30
illuminate/support Version ^13.30
intervention/image Version ^4.3
jkudish/laravel-ai-pricing Version ^0.2.1
laravel/ai Version ^1.0.1
opis/json-schema Version ^2.6
spatie/pdf-to-text Version ^1.55
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 jkudish/laravel-document-extraction contains the following files

Loading the files please wait ...