Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Php Apache Tika

Php Apache Tika Laravel Package

vaites/php-apache-tika

PHP bindings for Apache Tika that extract text, HTML, and metadata from documents, images, and other formats. Run the JAR via CLI or use the faster Tika server mode over HTTP. Supports local and remote resources, OCR, and Apache Tika 1.15+.

View on GitHub
Deep Wiki
Context7

Apache Tika bindings for PHP: extract text and metadata from documents, images and other formats

Frequently asked questions about Php Apache Tika
How do I install vaites/php-apache-tika in a Laravel application?
Install it with composer require vaites/php-apache-tika. The package needs PHP 7.3 or greater with the mbstring and cURL extensions enabled. You also need Apache Tika 1.15 or greater and Java available, either as a local JAR for app mode or a running TikaServer for server mode. In Laravel, bind the client as a singleton in a service provider and keep host, port, and timeout values in a config file.
What is the difference between app mode and server mode in php-apache-tika?
App mode shells out to java -jar for every extraction, so you pay JVM startup costs measured in seconds plus per-process memory. Server mode sends HTTP requests to a long-running TikaServer instance and is roughly five times faster according to the README. Use server mode in production because it is stateless and scales horizontally. App mode is only sensible for local development or one-off CLI batch jobs where you cannot run a background service.
Which PHP and Laravel versions does this Tika package support?
The package requires PHP 7.3 or greater with mbstring and cURL, and works on Linux, macOS, and Windows. It is framework agnostic, so any Laravel release running on a supported PHP version can use it. The README states compatibility with Apache Tika 1.15 or greater, tested up to 1.28.5, 2.9.4, and 3.2.2.
Does php-apache-tika support OCR for scanned PDFs and images?
Yes, OCR recognition is one of the advertised features alongside text, HTML, and metadata extraction. The OCR itself is performed by Apache Tika, not the PHP library, so Tesseract must be installed inside your Tika image or host. OCR is significantly slower than plain text extraction, so budget queue capacity and timeouts accordingly.
How do I configure the Tika client in a Laravel service provider?
Create a config/tika.php file containing the mode, host, port, and timeout, then bind the Tika client as a singleton in a service provider using those values. Inject the client, or your own DocumentExtractor contract that wraps it, rather than resolving it statically inside controllers. This keeps the package confined to the infrastructure layer so it can be swapped later. Dispatch extraction to a queued job for anything larger than a small document.
Can it extract document metadata as well as plain text?
Yes, the library exposes text extraction, HTML extraction, and metadata extraction through a simple class interface. Metadata is standardized across document formats, which makes storing it in a JSON column straightforward. You can request both text and metadata from the same call, then persist each where it belongs.
How should I test code that uses php-apache-tika?
Wrap the package behind your own DocumentExtractor interface and substitute a fake implementation in unit tests, so no Tika process is needed. For integration tests, run a TikaServer container in CI and point the client at it rather than hitting a shared remote instance. Because the package is a thin client, most of your application logic can be tested without Tika at all.
Is it safe to parse untrusted user uploads with Apache Tika?
Parsing untrusted files with Tika is a genuine attack surface that includes XXE, archive bombs, and historical deserialization issues. Run Tika in a network-isolated container with CPU and memory caps, never expose it publicly, and allow only the application tier to reach it. Validate file size and type before sending anything, and treat the extracted text as a full copy of user data subject to the same retention and PII controls.
Should document extraction run synchronously or in a Laravel queue?
A Tika call is a synchronous HTTP request, so anything beyond a very small document should be pushed to a queued job. Persist the extracted text to a search index or object storage with a pointer on the model, and store a status per document such as pending, extracted, unsupported, or failed. Running through Horizon or a Redis queue gives you retries, concurrency control, and visibility for free.
Is vaites/php-apache-tika actively maintained, and what are the alternatives?
It is MIT licensed with a 2025 release and CI badges, but it is effectively a single-maintainer wrapper with a small dependent base. The mitigation is that it is a thin veneer over the documented Tika REST API, so falling back to direct HTTP calls takes days rather than weeks. Alternatives include calling the TikaServer endpoint yourself, or narrower libraries such as Smalot/pdfparser if you only need PDF text.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo