Download the PHP package subhashladumor1/laravel-ai-docs without Composer

On this page you can find all versions of the php package subhashladumor1/laravel-ai-docs. 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-ai-docs

Laravel AI Docs

Latest Version on Packagist PHP Version Laravel

Turn any PDF, image, audio or Word document into structured, searchable intelligence โ€” powered by GPT-5.2, Claude 4.6, or Gemini 3.1 โ€” with a single line of Laravel code.


What Is This Package?

Imagine your users are uploading invoices, contracts, scanned receipts, meeting recordings or medical reports. You need to extract data, answer questions, generate summaries, and build searchable databases โ€” without writing thousands of lines of AI integration code.

Laravel AI Docs handles all of that with a fluent, chainable API:


How It Works

The package sits as an intelligent layer between your Laravel app and AI providers. When you call AIDocs::pdf($file), it:

  1. Validates the file (type, size, existence)
  2. Extracts raw content using native parsers (smalot/pdfparser, PhpWord)
  3. Detects if the document is scanned and needs OCR
  4. Processes images or audio through pre-processing pipelines
  5. Sends a carefully crafted prompt to your chosen AI (OpenAI, Claude, or Gemini)
  6. Returns the result as a string, array, or typed DocumentResultDTO

Installation

Publish the config file:

Add your API keys to .env:


๐Ÿงช Open Source Laravel AI Docs Lab

Want to test this package before integrating it? We've built an open-source testing UI where you can upload documents, test all AI models, and experiment with the API visually!

Laravel AI Docs Lab

๐Ÿ‘‰ Get the Laravel AI Docs Lab on GitHub

Real-World Example 1 โ€” Invoice Processing System

Your e-commerce platform receives thousands of supplier invoices as PDFs every day. You need to extract line items, totals, vendor names and due dates automatically.

How the data flows for this example:


Real-World Example 2 โ€” Legal Contract Q&A Chatbot

A law firm wants to let paralegals ask plain-English questions about uploaded contracts without reading hundreds of pages.

How the RAG pipeline works:


Real-World Example 3 โ€” Medical Report Digitization

A hospital scans paper patient forms. The images need to be converted to searchable database records.

Image OCR flow:


Real-World Example 4 โ€” Meeting Minutes Automation

Your team records all meetings. You want automatic transcriptions and action-item summaries sent to Slack.


Real-World Example 5 โ€” Multi-Language Document Portal

A global company receives documents in English, Arabic, French, Chinese, and Russian. Your portal needs summaries in the original language.

Language detection flow:


Real-World Example 6 โ€” Financial Report Dashboard

A fintech app ingests quarterly earnings PDFs and extracts all financial tables for charting.


Switching AI Providers

You can switch providers per-request. No config changes needed โ€” just chain .model() or .provider():

Alias Provider Best For
gpt-5.2 / gpt-5 OpenAI Latest generation general documents, max accuracy
gpt-5.2-pro OpenAI Advanced reasoning tasks
gpt-5-mini / gpt-5-nano OpenAI Scanned images, vision tasks, fast processing
claude-sonnet-4-6 Anthropic Latest iteration for long documents, legal, code
claude-opus-4-6 Anthropic Maximum reasoning depth
claude-haiku-4-5 Anthropic Fast, cost-efficient summarization
gemini-3.1-pro-preview Google Multilingual, ultra-large context
gemini-3-pro-preview Google Advanced reasoning and logic
gemini-3-flash-preview Google High speed, low cost
gemini-2.5-pro Google Previous generation pro model

The Full Pipeline Explained


DocumentResultDTO โ€” Your Data Container

Every ->result() call returns a typed DocumentResultDTO. It's immutable and holds everything your pipeline produced:


Working with Tables


Complete API Reference

Manager Methods โ€” Available on AIDocs::

These three methods configure the active provider and language before you call an entry point. They return a cloned, immutable instance โ€” so chains never interfere with each other.

Method Returns Description
AIDocs::model(string $alias) AIDocsManager Switch provider + model via alias, e.g. 'gpt-5-mini', 'claude-sonnet-4-6'
AIDocs::provider(string $name) AIDocsManager Switch provider by name: 'openai', 'claude', 'gemini'
AIDocs::language(string $code) AIDocsManager Force a language code, e.g. 'ar', 'fr', 'zh'

Entry Points โ€” What File Type to Process

Method Returns Accepts
AIDocs::pdf(string $path) PDFBuilder .pdf
AIDocs::image(string $path) ImageBuilder .jpg, .jpeg, .png, .gif, .bmp, .webp, .tiff
AIDocs::audio(string $path) AudioBuilder .mp3, .mp4, .m4a, .wav, .webm, .ogg
AIDocs::document(string $path) DocumentBuilder .pdf, .docx, .doc, .txt, .md

Tip: Use AIDocs::pdf() for PDFs with special handling (scanned detection, page count). Use AIDocs::document() when you want one entry point for any document type.


PDFBuilder โ€” Full Method Reference

Returned by AIDocs::pdf($path). Text is automatically extracted on construction so all methods below work immediately.

Chainable Methods (return static โ€” can be chained)

Method Signature What It Does
language language(string $code): static Override the detected language for all subsequent AI calls
enhance enhance(): static Pre-processing hook (extensible, currently a no-op)
summarize summarize(?string $prompt = null): static Generate an AI summary. Pass custom $prompt to control the output style
tables tables(): static Extract all tabular data into TableDTO[] objects

Terminal Methods (return a final value โ€” end the chain)

Method Signature Returns What It Does
text text(): string string Return the raw extracted PDF text
pages pages(): int int Return the total page count
ask ask(string $question): string string RAG Q&A: answer a question using the document as context
toJson toJson(?string $prompt = null): array array Extract structured JSON from the document
structured structured(): array array Generate a structured extraction (alias for toJson with a structured focus)
toMarkdown toMarkdown(): string string Build a Markdown document from whatever was accumulated
result result(): DocumentResultDTO DocumentResultDTO Collect everything into a typed result object

Every Useful PDFBuilder Combination


ImageBuilder โ€” Full Method Reference

Returned by AIDocs::image($path). Unlike PDF/Document builders, text is NOT extracted on construction โ€” it is lazily extracted when you first call a method that needs it.

Chainable Methods

Method Signature What It Does
language language(string $code): static Set language hint for OCR extraction

Terminal Methods

Method Signature Returns What It Does
text text(?string $prompt = null): string string OCR: extract all text. Pass a custom prompt to control extraction focus
summarize summarize(?string $prompt = null): string string Extract text then summarize it
tables tables(): array TableDTO[] Extract text then find tables
ask ask(string $question): string string Extract text then answer a question about it
toJson toJson(): array array Extract text then convert to structured JSON
result result(): DocumentResultDTO DocumentResultDTO Extract text then return a full result object

Every Useful ImageBuilder Combination


AudioBuilder โ€” Full Method Reference

Returned by AIDocs::audio($path). Audio requires OpenAI Whisper (Claude and Gemini do not support direct audio transcription).

Chainable Methods

Method Signature What It Does
language language(string $code): static Hint the transcription language for better accuracy

Terminal Methods

Method Signature Returns What It Does
transcribe transcribe(): string string Transcribe audio to text using Whisper
summarize summarize(?string $prompt = null): string string Transcribe then summarize the transcript
result result(): DocumentResultDTO DocumentResultDTO Transcribe and return full result (transcript is in both rawText and transcript)

Every Useful AudioBuilder Combination

Note: Audio transcription is only supported by the OpenAI provider (Whisper). Calling AIDocs::provider('claude')->audio(...) or AIDocs::provider('gemini')->audio(...) will throw a FileProcessingException.


DocumentBuilder โ€” Full Method Reference

Returned by AIDocs::document($path). Handles DOCX, DOC, TXT, MD and also PDF. Text is automatically extracted on construction based on file extension.

Chainable Methods

Method Signature What It Does
language language(string $code): static Override the detected language
enhance enhance(): static Pre-processing hook (extensible)
summarize summarize(?string $prompt = null): static AI summarization
tables tables(): static Extract all tables

Terminal Methods

Method Signature Returns What It Does
text text(): string string Return raw extracted text
ask ask(string $question): string string RAG Q&A over the document
toJson toJson(?string $prompt = null): array array Structured JSON extraction
toMarkdown toMarkdown(): string string Build Markdown document
result result(): DocumentResultDTO DocumentResultDTO Full typed result object

Every Useful DocumentBuilder Combination


DocumentResultDTO โ€” All Properties & Methods

Every ->result() call returns a DocumentResultDTO. It is immutable โ€” values are set once and never change.

Properties

Property Type Populated By
$rawText string Always โ€” extracted document text
$summary ?string ->summarize()
$tables TableDTO[] ->tables()
$markdown ?string ->toMarkdown()
$json ?array ->toJson()
$language ?string Auto-detected or via ->language()
$mimeType ?string Detected from the file
$filePath ?string The source file path
$provider ?string 'openai', 'claude', 'gemini'
$model ?string e.g. 'gpt-5.2', 'claude-sonnet-4-6'
$processingTimeSeconds float Wall-clock time the pipeline took
$transcript ?string Audio only โ€” same as $rawText for audio

Helper Methods

Usage Examples


TableDTO โ€” All Properties & Methods

Each item in $result->tables is a TableDTO.


Configuration Reference

After publishing (php artisan vendor:publish --tag=ai-docs-config), you can tune every aspect in config/ai-docs.php:


Testing Your Integration

The package ships a FakeAIProvider โ€” write tests that never call real APIs:

Run all tests:


Package Architecture


License

MIT โ€” free for personal and commercial use. See LICENSE.


All versions of laravel-ai-docs with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2|^8.3
smalot/pdfparser Version ^2.0
phpoffice/phpword Version ^1.4
intervention/image-laravel Version ^1.5
guzzlehttp/guzzle Version ^7.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 subhashladumor1/laravel-ai-docs contains the following files

Loading the files please wait ...